Cet article décrit la méthode de JS pour déterminer si un iframe est chargé. Partagez-le pour votre référence, comme suit:
<! Doctype html public "- // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <éad> <méta http-equiv = "contenu-type" content = "text / html; charset = gb2312 "> <ititle> </ title> </ head> <body> <script type =" text / javascript "> var isie = /msie/i.test(navigator.UserAgent) &&! window.opera; var iframe = document.createElement (" iframe "); iframe.src =" //ww.vevb.com/if (iframe) {antie) iframe.onreadystateChange = function () {if (iframe.readystate == "chargé" || iframe.readystate == "complet") {alert ("chargé"); }};} else {iframe.onload = function () {alert ("chargé"); };} document.body.appendChild (iframe); </ script> </body> </html>ou:
<! Doctype html public "- // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <éad> <méta http-equiv = "contenu-type" content = "text / html; charset = gb2312 "> <itle> </ title> </ head> <body> <script type =" text / javascript "> var iframe = document.createElement (" iframe "); iframe.src =" //www.vevb.com/" ;if (iframe.attachevent) {iframe.attachevent ("sur sur la charge",) alert ("chargé");});} else {iframe.onload = function () {alert ("chargé"); };} document.body.appendChild (iframe); </ script> </body> </html>Pour plus d'informations sur le contenu lié à JavaScript, veuillez consulter les sujets de ce site: "Résumé de l'opération JavaScript Iframe Skills", "Résumé des compétences en algorithme de recherche JavaScript", "Résumé des algorithmes de traits javascript JavaScript Switching Effets et compétences spéciaux "," Résumé de l'animation JavaScript Effets et compétences spéciaux "," Résumé des erreurs JavaScript et des compétences de débogage "et" Résumé de l'utilisation de l'opération mathématique JavaScript "
J'espère que cet article sera utile à la programmation JavaScript de tous.