位置:首页 > 编程专栏 > JavaScript

js为div赋值

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<html>
<head>
<title>搜索</title>
<script>
    window.onload = function () {
        var d = document.getElementById('a');
        d.innerHTML = '这里输入为div赋值的内容';
    }
</script>
</head>

<body>
<div id="a">
</div>
<div style="white-space:nowrap;">

</div>
</body>
</html>

C# 社区推荐