作者sanforever (corn)
看板PHP
標題[請益] setTimtout
時間Sun Dec 16 18:57:46 2007
function clks()
{
var str=new Date();
document.write(str.getHours()+":");
document.write(str.getMinutes()+":");
document.write(str.getSeconds());
// status=str.getHours()+":"+str.getMinutes()+":"+str.getSeconds();
setTimeout("clks()",1000);
}
clks();
知道問這裡很奇怪...可是我不知道要去哪問了=.=
為啥執行這個函數會出問題,可是如果執行
status那行,註解掉write那三行,讓狀態列顯示時間就沒問題
這是為啥???
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.94.88
推 itisjoe:ajax版可以討論javascript歐~ 12/16 20:35
推 fillano:簡單地說,document.write會把clks函數毀掉 12/16 21:18