JS之更新层内容测试

来源:互联网 发布:淘宝网电脑下载安装 编辑:程序博客网 时间:2024/06/08 05:01

我认为其中最值得注意的地方就是innerHTML之后的值是用等号来赋值,而不是innerHTML("<h3>the new things</h3>").

<html>
<head>
<title>更新层内容测试</title>
<script type="text/javascript" language="javascript">
function MyChange(){
document.getElementById("b").innerHTML="<h3>the new things</h3>";
}
</script>
</head>
<body>
<h3 align="center">更新层内容测试</h3>
<div id="b">
<h3>旧内容</h3>
</div>
<input type="button" value="点击更新" onClick="MyChange()"/>
</body>
</html>
0 0