动态时间
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>时间data</title> | |
| </head> | |
| <body> | |
| <div id="linkweb" style=" display:inline;"></div> | |
| <script> | |
| setInterval("document.getElementById('linkweb').innerHTML=new Date().toLocaleString()" + | |
| "+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000); | |
| </script> | |
| <!-- | |
| setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式。 | |
| setInterval(code,millisec)code 必需。 | |
| 要调用的函数或要执行的代码串。 | |
| millisec 必须。周期性执行或调用 code 之间的时间间隔,以毫秒计。 | |
| toLocaleString()把数组转换为本地字符串。 | |
| charAt() 方法可返回指定位置的字符。 | |
| getDay() 方法可返回表示星期的某一天的数字。 | |
| --> | |
| </body> | |
| </html> | |

浙公网安备 33010602011771号