1. <html>
  2. <head>
  3.  
  4. </head>
  5. <body>
  6. <script>
  7. function loadScript(url, callback){
  8. var script = document.createElement("script")
  9. script.type = "text/javascript";
  10. if (script.readyState){ //IE
  11. script.onreadystatechange = function(){
  12. if (script.readyState == "loaded" || script.readyState == "complete"){
  13. script.onreadystatechange = null;
  14. callback();
  15. }
  16. };
  17. } else { //Others
  18. script.onload = function(){
  19. callback();
  20. };
  21. }
  22. script.src = url;
  23. document.getElementsByTagName("head")[0].appendChild(script);
  24. }
  25. loadScript("http://www.x.com", function(){
  26. loadScript("http://www.xu.net", function(){
  27. loadScript("http://www.shum.org", function(){
  28. alert("All files are loaded!");
  29. });
  30. });
  31. });
  32.  
  33. </script>
  34. </body>
  35.  
  36. </html>
  1. <html>
  2. <head>
  3.  
  4. </head>
  5. <body>
  6. <iframe id="if" ></iframe>
  7. <script language="javascript" type="text/javascript">
  8. //var ifr = document.createElement("iframe");
  9. var ifr = document.getElementById("if");
  10. //ifr.align='center';
  11. //ifr.marginwidth=1;
  12. //ifr.marginheight=1;
  13. //ifr.frameborder=0;
  14. //ifr.scrolling="No";
  15. //ifr.width =1007;
  16. //ifr.height=3800;
  17. ifr.src = 'http://www.xueg.com';
  18. if (ifr.attachEvent){
  19. ifr.attachEvent("onload", function(){
  20. //alert("Local if is now loaded attachEvent.");
  21. var iframe = document.createElement('iframe'); //
  22. iframe.src="http://www.baidu.com"; //
  23. document.body.appendChild(iframe); //
  24. });
  25. } else {
  26. ifr.onload = function(){
  27. alert("Local if is now loaded.");
  28. };
  29. }
  30. </script>
  31.  
  32. <script type="text/javascript">
  33. //$LAB
  34. //.script("script3.js").wait()
  35. ////.script("script2-a.js")
  36. ////.script("script2-b.js")
  37. //.wait(function(){
  38. ////initScript3();
  39. ////initScript2();
  40. //})
  41. //.script("script1.js")
  42. //.wait(function(){
  43. //initScript1();
  44. //});
  45. </script>
  46.  
  47. </body>
  48. </html>
  1. <!--
  2. var frame = document.getElementById("框架id");
  3. frame.onreadystatechange = function(){
  4. if( this.readyState == "complete" )
  5. alert("加载完毕!");
  6. }
  7. //-->

测试JS的更多相关文章

  1. HTMLPage测试js通过ajax调用

    HTMLPage测试js通过ajax调用接口 <!DOCTYPE html> <html lang="en" xmlns="http://www.w3. ...

  2. 利用Js的console对象,在控制台打印调式信息测试Js

    一次偶然的机会,打开百度的时候按下了F12,然后就见控制台里面输出了百度的招聘广告,感觉挺帅气的,再然后就有了这篇博文. 既然可以这样在控制台输出信息,那以后再调试Js的时候不就可以省去很多麻烦了嘛! ...

  3. 测试JS基本类型以及对象的引用

    自己敲的. 1 <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js&qu ...

  4. try 、catch 、finally 、throw 测试js错误

    try语句允许我们定义在执行时进行错误测试的代码块. catch 语句允许我们定义当 try 代码块发生错误时,所执行的代码块. finally 语句在 try 和 catch 之后无论有无异常都会执 ...

  5. 测试Js权限

    '12222' 测试一下 刚兴趣的可以参考: http://www.cnblogs.com/littledu/archive/2011/05/08/2040298.html http://www.cn ...

  6. 测试JS方法运行时间

    console.time(label) 和 console.timeEnd(label), 在开始的地方写上 console.time("测试 fn 速度: ") ,在结束的地方写 ...

  7. angularJS入门小Demo【简单测试js代码的方法】

    1.首先建立一个文件夹 demo, 2.在其中建立一个文本文档,改名为 demo-1.html, 3.把html中要引入的 js 文件拷贝到 demo目录下, 4.然后用 Notepadd++ 编辑刚 ...

  8. 测试 js 方法运行时间

    早期测速的时候是这样的,呵呵呵,一开始还挺爽的 function testFunctionTime(fn) { var start = new Date().getTime(); if (fn) fn ...

  9. chrome浏览器测试js函数

    1.直接在console中写入代码 2.既要写函数,又要写执行函数的代码. 不关闭网页,函数能够在内存中存活很久 浏览器都能记住函数. 当然,在其他页面无效.

随机推荐

  1. [Everyday Mathematics]20150108

    设 $f$ 在 $(a,b)$ 上 $n+1$ 次可导, 且 $$\bex \ln\frac{f(b)+f'(b)+\cdots+f^{(n)}(b)}{f(a)+f'(a)+\cdots+f^{(n ...

  2. Mysql 多表联合查询效率分析及优化

    1. 多表连接类型 1. 笛卡尔积(交叉连接) 在MySQL中可以为CROSS JOIN或者省略CROSS即JOIN,或者使用','  如: SELECT * FROM table1 CROSS JO ...

  3. Android中GridView滚动到底部加载数据终极版

    之前在项目中有一个需求是需要GridView控件,滚动到底部自动加载.但是呢GridView控件并不提供诸如ListView监听滚动到底部的onScrollListener方法,为了实现这样一个效果, ...

  4. 【原创】用python实现shell的tail操作

    在工作过程中发现监控实时刷新文件时,不是那么的任性. 故结合shell中的tail,做了一个类似tail的python脚本. 详情如下: #!/usr/bin/env python #coding=u ...

  5. LightOJ 1427 -Repository(ac自动机)

    题意: 求每个模式串在母串中出现的次数 #include <map> #include <set> #include <list> #include <cma ...

  6. 【LeetCode 209】Minimum Size Subarray Sum

    Given an array of n positive integers and a positive integer s, find the minimal length of a subarra ...

  7. Spring 中context.start作用

    我们经常会看到 如下代码 ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(configPath. ...

  8. HDU5734:Acperience(方差)

    题意: 给出n个数xi,确定一个值α,使得Σ(xi-α)^2的值最小. 分析: 可以猜想是方差,不懂得可以去方差了解一下. 那么α即为∑(xi)/n,然后要注意的是转化为分数,首先我们不能用小数转分数 ...

  9. Junit3.8 私有方法测试

    1. 测试类的私有方法时可以采取两种方式:1) 修改方法的访问修饰符,将private修改为default或public(但不推荐采取这种方式).2) 使用反射在测试类中调用目标类的私有方法(推荐). ...

  10. POJ动态规划题目列表

    列表一:经典题目题号:容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1191,1208, 1276, 13 ...