比直接写HTML肯定是要慢的,只是少量的话,可能看不出来速度的慢。
解决方案 »
- 请教一个JS问题,IE运行“拒绝访问”,FF运行没问题
- mediaPlayer的WPL格式列表动态播放问题!!
- 帮忙看看这段JS为什么不能执行呢很简单·!高分~~~~~~~~~~~~~~~~~~急!~!!!
- window.open跳转的问题
- javascirpt数字段截取问题
- 如何让一个链接只有在特定的时间内可以点击?
- JavaScript大人进:怎么能够实现像CSDN这样的点击左边框架的一个链接,随之其内容在右边框架打开的效果
- 网页上链接的word文档怎样单击一下,开始下载到本地,完成后用word打开?
- ATL开发及javascrip
- websocket 连接出错,access_denied,有大神遇到过这个问题吗?怎么解决的?
- 如何实现这样一个元素?
- 请教,这样的 htm 怎么取得 body 里的html?
我的测试方法是:
test1.html------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var start = new Date().getTime();
for(var i = 0;i <= 500; i ++){
document.writeln('<input name="stype" type="radio" id="sight" checked>景点')
document.writeln('<input type="radio" name="stype" id="pic">图片')
document.writeln('<input type="radio" name="stype" id="article">游记')
document.writeln('<input type="radio" name="stype" id="video">视频')
document.writeln('<input type="radio" name="stype" id="map">地图')
document.writeln('<input type="radio" name="stype" id="emap">电子地图')
document.writeln('<input type="radio" name="stype" id="weather">天气')
document.writeln('<input type="radio" name="stype" id="blogs">博客</td>')
}
var end = new Date().getTime();
alert(end -start);
</script>
</head><body>
</body>
</html>test2.asp----------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var start = new Date().getTime();
for(var i = 0;i <= 500; i ++){
document.writeln('<input name="stype" type="radio" id="sight" checked>景点')
document.writeln('<input type="radio" name="stype" id="pic">图片')
document.writeln('<input type="radio" name="stype" id="article">游记')
document.writeln('<input type="radio" name="stype" id="video">视频')
document.writeln('<input type="radio" name="stype" id="map">地图')
document.writeln('<input type="radio" name="stype" id="emap">电子地图')
document.writeln('<input type="radio" name="stype" id="weather">天气')
document.writeln('<input type="radio" name="stype" id="blogs">博客</td>')
}
var end = new Date().getTime();
alert(end -start);
</script>
<input onkeypress="insert(this)">
</head><body>
9654
</body>
</html>
----------------------------------------------------------------------------
结果分别是:
次数 test1.html test2.asp
1 1622 1903
2 1632 1683
3 1633 1692
------加入随机参数---------------------
1 1662 1762
2 1663 1763
3 1732 1803
4 1742 1773
5 1713 1912---------------------------------------
波动应该是受我电脑的影响,但总体趋势很明显。...test1.html快
--------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script language="javascript">
var start = new Date().getTime();
</script>
<%for i=0 to 500%>
<input name="stype" type="radio" id="sight" checked>景点
<input type="radio" name="stype" id="pic">图片
<input type="radio" name="stype" id="article">游记
<input type="radio" name="stype" id="video">视频
<input type="radio" name="stype" id="map">地图
<input type="radio" name="stype" id="emap">电子地图
<input type="radio" name="stype" id="weather">天气
<input type="radio" name="stype" id="blogs">博客</td>
<%next%>
<script language="javascript">
var end = new Date().getTime();
alert(end -start);
</script>
</head>
<body>
</body>
</html>