setInterval(clock,100) 與self.setInterval(clock,100)的區別
在w3c上看到的例子是這樣用 setInterval()方法的。
這兩個有什么不同??
<html> <body> <input?type="text"?id="clock"?size="35"?/> <script?language=javascript> var?int=self.setInterval("clock()",50)function?clock() ?{ ?var?t=new?Date() ?document.getElementById("clock").value=t ?} </script> </form> <button?onclick="int=window.clearInterval(int)">Stop?interval</button> </body> </html>
2015-10-16
self代表當前頁面