判断div.style.display==""和div.style.display=="none"
解决方案 »
- 求助!chrome的关于fakepath的解决办法
- extjs CheckboxGroup根据combobox的值重新渲染items
- 回车替换tab键问题
- 文本框初始文字的设置
- 如何让这样的东西左右对齐 ff看下效果 ie下也看下
- 如何叫页面的js封装起来
- 求助中在线等
- 一个firefox与IE兼容的问题,点击图片显示div
- javscript如何获取当前路径的准确地址
- 在 function 中不直接引用 object id,也不通过 arguments 传递,怎样得到 object 呢?
- 【共享】刚刚做的一个 JS简单时间控件【JS时分秒时间控件】
- 500rmb报酬,谁能帮我做一个javascripts的题
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>new page</title>
<script>
function show(i){
document.getElementById("div"+i).style.display="block";
if(document.getElementById("hidden1").value!=""&&document.getElementById("hidden1").value!="div"+i){
document.getElementById(document.getElementById("hidden1").value).style.display="none";
}
document.getElementById("hidden1").value="div"+i;
}
</script>
</head>
<body>
<div id=div1 style="position:absolute;left:0px;top:100px;width:100px;height:100px;background-color:#dddddd;display:none">div1</div>
<div id=div2 style="position:absolute;left:100px;top:100px;width:100px;height:100px;background-color:#cccccc;display:none">div2</div>
<div id=div3 style="position:absolute;left:200px;top:100px;width:100px;height:100px;background-color:#bbbbbb;display:none">div3</div>
<div id=div4 style="position:absolute;left:300px;top:100px;width:100px;height:100px;background-color:#aaaaaa;display:none">div4</div>
<input type=hidden id=hidden1 value="">
<input type=button value="显示div1" onclick=show(1)>
<input type=button value="显示div2" onclick=show(2)>
<input type=button value="显示div3" onclick=show(3)>
<input type=button value="显示div4" onclick=show(4)>
</body>
</html>
当鼠标不经过Div1,而直接移动到2 3 4的时候,Div1的表格并不会隐藏……很奇怪,不知道怎么修改
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> new page </title>
<script>
function show(i){
document.getElementById("div"+i).style.display = "block";
if(document.getElementById("hidden1").value != "" && document.getElementById("hidden1").value != "div" + i){
document.getElementById(document.getElementById("hidden1").value).style.display= "none";
}
document.getElementById("hidden1").value= "div"+i;
}
</script>
</head>
<body>
<div id=div1 style= "position:absolute;left:0px;top:100px;width:100px;height:100px;background-color:#dddddd;display:"> div1 </div>
<div id=div2 style= "position:absolute;left:100px;top:100px;width:100px;height:100px;background-color:#cccccc;display:none"> div2 </div>
<div id=div3 style= "position:absolute;left:200px;top:100px;width:100px;height:100px;background-color:#bbbbbb;display:none"> div3 </div>
<div id=div4 style= "position:absolute;left:300px;top:100px;width:100px;height:100px;background-color:#aaaaaa;display:none"> div4 </div>
<input type=hidden id=hidden1 value="">
<table>
<tr>
<td onmouseover="show(1)">
ShowDIV1
</td>
<td onmouseover="show(2)">
ShowDIV1
</td>
<td onmouseover="show(3)">
ShowDIV1
</td>
<td onmouseover="show(4)">
ShowDIV1
</td>
</tr>
<table>
</body>
</html>