<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>DiV元素的隐藏与显示</title>
</head>
<body>
<script language="javascript">...
<!--
var divobj = "no";
function ChangeColor(obj)
...{
var flag = document.getElementById(obj).style.display;
if(flag == "none")
document.getElementById(obj).style.display = "block";
if(divobj == "no")
...{
document.getElementById(obj).style.backgroundColor = "#FFCC00";
divobj = "yes";
}
else
...{
document.getElementById(obj).style.backgroundColor = "#FFFFFF";
divobj = "no";
}
}
function HiddenShow(obj)
...{
var flag = obj.style.display;
if(flag == "")
obj.style.display = "none";
else
obj.style.display = "";
}
-->
</script>
<div id="targetDiv" onClick="HiddenShow(this);" style="border:1px solid #000;width:150px;cursor:pointer;" title="单击隐藏">
Lee Cong Text</div>
<input type="button" value="改变Color" onclick="ChangeColor('targetDiv');">
</body>
</html>
1678

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



