Html onclick iframe video

Bl4ckC4p_03

Eternal Poster
Anong mali po dito sa code? Gusto ko kasi gumawa ng onclick iframe na pwede ma full screen yung video sa loob ng site.


<button onclick="openIframe()">Open Iframe</button>

<script>
function openIframe() {
var iframe = document.createElement('iframe');
iframe.width = '560';
iframe.height = '315';
iframe.src = 'You do not have permission to view the full content of this post. Log in or register now.
iframe.allowfullscreen = true;

var button = document.querySelector('button');
button.parentNode.replaceChild(iframe, button);
}
</script>


Di kasi nya nag fufull screen kahit iclick ko yung full screen eh, pero pag normal iframe lang na naka allowfullscreen gumagana naman
 
Sa iyong code, mayroong ilang mga mali. Tingnan natin ang mga ito:

1. Ang iyong URL sa loob ng iframe.src ay hindi tamang format. Kailangan mong tanggalin ang mga [URL] at [/URL] tags. Ang tamang format ay:

JavaScript:
iframe.src = 'https://anix.to/home';

2. Ang iframe.allowfullscreen ay hindi isang direktang attribute ng isang iframe element. Kailangan mong gamitin ang setAttribute function upang itakda ang allowfullscreen attribute. Narito ang naayos na code:

JavaScript:
function openIframe() {
  var iframe = document.createElement('iframe');
  iframe.width = '560';
  iframe.height = '315';
  iframe.src = 'https://anix.to/home';
  iframe.setAttribute('allowfullscreen', true);
  
  var button = document.querySelector('button');
  button.parentNode.replaceChild(iframe, button);
}

3. Siguraduhin mong ang iyong script ay nasa tamang lugar sa iyong HTML code. Dapat ito ay nasa ibaba ng <button> element, o kahit saan basta't ito ay nasa loob ng <body> tag.

Dapat ay maayos na gumagana ang iyong code upang maipakita ang iframe at mabigyan ng kakayahan ang video na maging fullscreen.
 
Sa iyong code, mayroong ilang mga mali. Tingnan natin ang mga ito:

1. Ang iyong URL sa loob ng iframe.src ay hindi tamang format. Kailangan mong tanggalin ang mga [URL] at [/URL] tags. Ang tamang format ay:

JavaScript:
iframe.src = 'https://anix.to/home';

2. Ang iframe.allowfullscreen ay hindi isang direktang attribute ng isang iframe element. Kailangan mong gamitin ang setAttribute function upang itakda ang allowfullscreen attribute. Narito ang naayos na code:

JavaScript:
function openIframe() {
  var iframe = document.createElement('iframe');
  iframe.width = '560';
  iframe.height = '315';
  iframe.src = 'https://anix.to/home';
  iframe.setAttribute('allowfullscreen', true);
 
  var button = document.querySelector('button');
  button.parentNode.replaceChild(iframe, button);
}

3. Siguraduhin mong ang iyong script ay nasa tamang lugar sa iyong HTML code. Dapat ito ay nasa ibaba ng <button> element, o kahit saan basta't ito ay nasa loob ng <body> tag.

Dapat ay maayos na gumagana ang iyong code upang maipakita ang iframe at mabigyan ng kakayahan ang video na maging fullscreen.
Talino mo, gumana nga
 
Talino mo, gumana nga
Salamat! Natutuwa akong malaman na gumana na ang iyong code. Kung mayroon ka pang ibang mga tanong o mga pangangailangan sa coding, huwag kang mag-atubiling magtanong muli. Ako ay nandito upang tulungan ka. Magpatuloy sa iyong paglalakbay sa pagpoprograma!
 
Ewan pero medyo creepy talaga ang AI natin dito sa PHCorner. Hahahahahaha




"Life is TOUGH but I don't give a shit because I know I am AWESOME"
๊งโ€ขโŠนูญ๐š‚๐š˜๐šž๐š• ๐™ฒ๐šŠ๐š•๐š’๐š‹๐š›๐šŽูญโŠนโ€ข๊ง‚
๐๐€๐“๐’๐”
 
Ewan pero medyo creepy talaga ang AI natin dito sa PHCorner. Hahahahahaha




"Life is TOUGH but I don't give a shit because I know I am AWESOME"

๊งโ€ขโŠนูญ๐š‚๐š˜๐šž๐š• ๐™ฒ๐šŠ๐š•๐š’๐š‹๐š›๐šŽูญโŠนโ€ข๊ง‚

๐๐€๐“๐’๐”
Tinanong ko muna yung sa open ai, pero nung tinest ko hindi parin gumana kaya nag tanong na ako dito, ayon alam pala ni phcrobot, si phc robot yata pinakamatalinong robot e hahah
 
Tinanong ko muna yung sa open ai, pero nung tinest ko hindi parin gumana kaya nag tanong na ako dito, ayon alam pala ni phcrobot, si phc robot yata pinakamatalinong robot e hahah
Ang knowledge bank ata ng PHC Robot at combined info dito sa thread at sa developers ng site kaya ganyan.. minsan medyo creepy nga lang talaga. hehehehe




"Life is TOUGH but I don't give a shit because I know I am AWESOME"
๊งโ€ขโŠนูญ๐š‚๐š˜๐šž๐š• ๐™ฒ๐šŠ๐š•๐š’๐š‹๐š›๐šŽูญโŠนโ€ข๊ง‚
๐๐€๐“๐’๐”
 

About this Thread

  • 6
    Replies
  • 647
    Views
  • 2
    Participants
Last reply from:
Soul Calibre

Trending Topics

Online now

Members online
322
Guests online
1,080
Total visitors
1,402

Forum statistics

Threads
2,273,580
Posts
28,950,449
Members
1,235,841
Latest member
tetetskieManiac
Back
Top