テストJS
16459 ワード
<html>
<head>
</head>
<body>
<script>
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" || script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}
loadScript("http://www.x.com", function(){
loadScript("http://www.xu.net", function(){
loadScript("http://www.shum.org", function(){
alert("All files are loaded!");
});
});
});
</script>
</body>
</html>
<html>
<head>
</head>
<body>
<iframe id="if" ></iframe>
<script language="javascript" type="text/javascript">
//var ifr = document.createElement("iframe");
var ifr = document.getElementById("if");
//ifr.align='center';
//ifr.marginwidth=1;
//ifr.marginheight=1;
//ifr.frameborder=0;
//ifr.scrolling="No";
//ifr.width =1007;
//ifr.height=3800;
ifr.src = 'http://www.xueg.com';
if (ifr.attachEvent){
ifr.attachEvent("onload", function(){
//alert("Local if is now loaded attachEvent.");
var iframe = document.createElement('iframe'); //
iframe.src="http://www.baidu.com"; //
document.body.appendChild(iframe); //
});
} else {
ifr.onload = function(){
alert("Local if is now loaded.");
};
}
</script>
<script type="text/javascript">
//$LAB
//.script("script3.js").wait()
////.script("script2-a.js")
////.script("script2-b.js")
//.wait(function(){
////initScript3();
////initScript2();
//})
//.script("script1.js")
//.wait(function(){
//initScript1();
//});
</script>
</body>
</html>
<!--
var frame = document.getElementById(" id");
frame.onreadystatechange = function(){
if( this.readyState == "complete" )
alert(" !");
}
//-->