關於JavaScript的window物件的status屬性
阿新 • • 發佈:2019-01-25
程式碼示例如下:
在瀏覽器的左下角可以看到其執行結果如下:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus?"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>狀態列顯示當前時間</title> </head> <script type="text/javascript"> <!-- function init(){ //拿到當前時間 var d = new Date() ; //設定狀態列的文字 self.status = d.toLocaleString() ; //self和window是等價的 //status:設定狀態列的文字 setTimeout("init()",1000) ; } //--> </script> <body onload = "init()"> </body> </html>
在瀏覽器的左下角可以看到其執行結果如下: