<script type="text/javascript">
var t=0;
function T()
{ document.open();
document.write(t);
document.close();
t++;
setTimeout("T()",1000);
}
window.onload=T;
</script>
这么短的代码都会出问题,
搞了半天不知道怎么回事,
希望高手能指点一下!!!
谢谢!!!
var t=0;
function T()
{ document.open();
document.write(t);
document.close();
t++;
setTimeout("T()",1000);
}
window.onload=T;
</script>
这么短的代码都会出问题,
搞了半天不知道怎么回事,
希望高手能指点一下!!!
谢谢!!!
了,代码什么的,啥都没了
<script>
t=0;
(function T(t)
{
v = "<script>" + arguments.callee + "(" + (t+1) + ")<\/script>";
setTimeout(function(){
document.open();
document.write(v+ t);
document.close();
},1000);
} )(0);
</script>
因为HTML文档加载完成以后,如果因为某个事件再触发document.write
那么document.write会首先把原有内容全部清空
<html>
<head>
<title></title>
</head>
<body>
<input id="tbTest" type="text" value="原有的内容会被清空" /><input type="button" value="document.write" onclick="Write()" /><script language="javascript" type="text/javascript">
function Write() {
var value = document.getElementById("tbTest").value;
document.write(value);
}
</script>
</body>
</html>
在文档加载完毕以后,你不应该再使用write或者writeln方法,除非你首先调用open方法,因为它会清除当前文档的Window对象和所有的变量
不知道我理解的对不对?
可是我就是首先调用的open方法啊?
就算会清除当前文档的Window对象和所有的变量,就相当于文档重新加载一次啊!
那也应该是显示0,也不至于报错啊???
谢谢了,还请再说的详细一点,好吗?
var t=0;
function T()