html>
<head>
<script type="text/javascript">
function run2(){
var imgId2 = document.getElementById("id2");
imgId2.style.visibility ="visible";
imgId2.src ="9s.gif";
}
</script>
</head>
<body>
<img name="img" id="id2" src="" style="visibility:hidden">
<input value="影藏显示:visibility" onclick="run2();" type="button"/>
</body>
</html>
<head>
<script type="text/javascript">
function run2(){
var imgId2 = document.getElementById("id2");
imgId2.style.visibility ="visible";
imgId2.src ="9s.gif";
}
</script>
</head>
<body>
<img name="img" id="id2" src="" style="visibility:hidden">
<input value="影藏显示:visibility" onclick="run2();" type="button"/>
</body>
</html>
本文介绍了如何通过JavaScript实现HTML元素的隐藏与显示操作,包括使用getElementById获取元素并设置其visibility属性。
271

被折叠的 条评论
为什么被折叠?



