<body>
<div id="a" onmouseover="viewb()" style=" width:100px ; height:50px;background-color:#0000CC">aaaa
</div>
<div id="b" style="display:none"onmouseout="closeb()" style="background-color:#CC0000; width:100px ; height:50px;">bbbbb
</div>
<script>
function viewb(){
document.getElementById("b").style.display = "";
}
function closeb(){
document.getElementById("b").style.display = "none";
}
</script>
</body>
解决方案 »
- js想做一个邀请好友的功能。FF不支持。
- 收集经典常用的jquery特效,,请大家把常用的写上。。。
- Div改变背景图片
- span那里哪儿错了,就是一个简单的点击一次计算一下,怎么第二行的那个显示不出来,找半天了
- 请教:<noscript> 使用方法,使onclick等javascript事件不起作用?
- 怎么用JAVASCRIPT控制网页刷新一次
- 如何获得控件的左下角坐标?
- 用Javascript怎么设置Cookies
- 请教为什么不能垂直居中对齐???
- nodejs的未来在哪里?
- 不知道在线编辑器的 [自动排版]功能怎么做!我看fck也没有这个功能!只有
- javascript 动态写表格有些表格属性没出来,帮看看,谢谢!
<head>
<title></title>
</head>
<body>
<div id="a" onmouseover="viewb()" onmouseout="closeb()" style=" width:100px ; height:50px;background-color:#0000CC">aaaa
</div>
<div id="b" style="display:none"onmouseout="closeb()" onmouseover="viewb()" style="background-color:#CC0000; width:100px ; height:50px;">bbbbb
</div>
<script>
function viewb(){
document.getElementById("b").style.display = "";
}
function closeb(){
document.getElementById("b").style.display = "none";
}
</script>
</body>
</html>
这样就ok了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type='text/css'>
.one{margin:10px; width:200px; height:160px; background-color:#ccc; font-size:30px; line-height:160px; text-align:center;color:#fff;}
</style>
<script type="text/javascript">
var t;
function hidden(){
t=setTimeout(function(){document.getElementById("B").style.display="none";},1000);
}
function show(){
clearTimeout(t);
}
</script>
</head>
<body >
<div class='one' onmouseover='document.getElementById("B").style.display="";' onmouseout='hidden()'>A</div>
<div class='one' id='B' style='display:none;' onmouseover='show()' onmouseout='hidden()'>B</div>
</body>
</html>