猿问

为什么document.write(a.id);不能显示?

为什么document.write(a.id);不能显示?用alert也不行

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/JavaScript">
        var a=document.getElementById("he");
        document.write(a.id);
    </script>
</head>
<body>
    <div id="he"></div>
</body>
</html>


weei2010
浏览 1197回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答