一个html隐藏/显示效果
---------------------------------------------------------------------------------------------------隐藏效果:
---------------------------------------------------------------------------------------------------
<html>
<head>
<title>隐藏效果</title>
<body>
<div id="div1" style="display:none;">how are you? 你能看到我吗?</div>
</body>
</html>
-----------------------------------------------------------------------------------------------------
隐藏与显示可切换效果:
-----------------------------------------------------------------------------------------------------
<html>
<head>
<title>隐藏/显示效果</title>
<script>
function show()
{
var span1=document.getElementById("span1");
var div1=document.getElementById("div1");
if(span1.innerText=="-")
{div1.style.display="none";
span1.innerText="+";
}
else
{div1.style.display="block";
span1.innerText="-";
}
}
</script>
</head>
<body>
<a href="javascript:show()"><span id="span1">+</span></a>[词语解释]
<div id="div1" style="display:none;">how are you? 你好吗?</div>
</body>
</html>
[ 本帖最后由 灰儿 于 2008-10-1 11:34 编辑 ]
页:
[1]