代碼如下:<!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=utf-8" /><title>無標題文檔</title><script type="text/javascript">setInterval(attime,1000);function attime(){ var time=new Date(); i=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds(); document.getElementById("showtime").value=i;}setInterval(attime,1000);function attime2(){ var time2=new Date(); i=time2.getHours()+":"+time2.getMinutes()+":"+time2.getSeconds(); document.getElementById("showtime2").value=i;}</script></head><body>現在時間是:<input type="text" size="40" id="showtime" />現在時間是:<input type="text" size="40" id="showtime2" /></body></html>運算后為什么,第二個input沒有顯示任何東西,是被跳過了嗎?還望大神指教
關于setInterval()的一個小問題
天瑜CJT
2014-07-19 13:20:02