您的位置:首页 > 其它

动态隐藏显示DIV

2009-03-03 10:05 323 查看
<html>
<head>
</head>
<body>
<script type="text/javascript">
function discontrol(itemid)
{
if(document.getElementById(itemid).style.display=='none')
{
document.getElementById(itemid).style.display="";
}
else
{
document.getElementById(itemid).style.display="none";
}
}
</script>
<a onclick="discontrol('test')" href="#">点击隐藏ID为test的DIV</a>
<div id="test" style="border: 1px solid rgb(238, 238, 238); padding: 5px; display:none">这是一段测试文字</div>
</body>
</html>

示例:

点击显示ID为test的DIV

这是一段测试文字
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: