document.getElementById()
<body>
<div id="time"> 2020-10-2 </div>
<script>
var timer = document.getElementById('time');
console.log(timer);
</script>
</body>
//控制台输出:<div id="time"> 2020-10-2 </div>
console.dir(变量) //输出详细内容
原创文章,作者:Carrie001128,如若转载,请注明出处:https://blog.ytso.com/272796.html