innerText 使用示例
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:functionshowTime(){//在元素间的文本就是通过对象.innerTextdocument.getEleme...
复制代码 代码如下:
<html>
<head>
<script language = "javascript" type = "text/javascript">
function showTime(){
//在元素间的文本就是通过 对象 .innerText
document.getElementById("mytime").innerText = new Date().toLocaleString();
}
setInterval("showTime()",1000);
</script>
</head>
<body>
<span id = "mytime"></span>
</body>
</html>