求一种DIV显示与隐藏的效果。 本帖最后由 even0220 于 2010-07-22 11:11:39 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Jquery有几个ToolTip效果的插件,你下载下来看看就OK了! position:absolute 定位 display:none/block 隐藏显示不过 地图是个 不规则的形状 我想知道你如果不用FLASH 鼠标经过的区域怎么划分 除非是用文字 动不动就JQ,好像世界没了JQ就不转了几行代码就搞定了,鼠标移入时将当前DIV 的ID,和其他相关数据传入动态设置浮动的DIV定位为相对,传入DIV为绝对,然后设置DIV的LEFT鼠标移入这2个DIV时浮动DIV不消失,移出就影藏,其他细节就根据你的需要自己定现在CSDN动不动就要写好的代码的人越来越多了 js 自己写几行代码就可以了用鼠标mouseOver 和mouseOut 事件div id 传到事件调用的方法div 的样式修改就可以了 哪个角是张图他就是定死的,你控制好 TOP和LEFT属性值就可以实现了 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>map.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <style type="text/css"> .map { width: 800px; height: 600px; background: transparent url("http://hiphotos.baidu.com/pjw4321/pic/item/13ae8d600d0e005cebf8f885.jpg") no-repeat center center; } .city { height: 40px; width: 50px; position: absolute; left: 505px; top: 490px; cursor: pointer; border: 1px solid red; } #show { display: none; height: 40px; width: 50px; position: absolute; z-index: 2; background-color: #CCCCFF; border: 1px solid #FFFF00; } </style> <script type="text/javascript"> function showTip(e) { var tipBox = document.getElementById("show"); tipBox.style.display = "block"; var event = e || window.event; tipBox.style.top = event.clientX + "px"; tipBox.style.left = event.clientY + "px"; } function hideTip() { var tipBox = document.getElementById("show"); tipBox.style.display = "none"; } </script> </head> <body> <div class="map"></div> <div class="city" onclick="alert('广东');" title="这是广东省,understand!" onmouseover="showTip(event)" onmouseout="hideTip()"></div> <div id="show">信息:这是广东省</div> </body></html> 2个脚本冲突的问题 。 放在一起只有一个有效 js给元素赋值(兼容性问题) 模态窗口大小会变的问题 javascript中如何在原事件的基础上加上新的方法? 请教个js打开新窗口的问题 下面的除了IE,NS支持吗? 新手求救! 怎样让一个正方形绕着自己的的对称中心不停的旋转? 如何实现树形菜单,急,在线等待! 动态表格:删除一行 window.open 打开窗口 处于 最上层? o.outerHTML = o.outerHTML;
动态设置浮动的DIV定位为相对,传入DIV为绝对,然后设置DIV的LEFT
鼠标移入这2个DIV时浮动DIV不消失,移出就影藏,其他细节就根据你的需要自己定
现在CSDN动不动就要写好的代码的人越来越多了
用鼠标mouseOver 和mouseOut 事件
div id 传到事件调用的方法
div 的样式修改就可以了
他就是定死的,你控制好 TOP和LEFT属性值就可以实现了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>map.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
.map {
width: 800px;
height: 600px;
background: transparent url("http://hiphotos.baidu.com/pjw4321/pic/item/13ae8d600d0e005cebf8f885.jpg") no-repeat center center;
}
.city {
height: 40px;
width: 50px;
position: absolute;
left: 505px;
top: 490px;
cursor: pointer;
border: 1px solid red;
}
#show {
display: none;
height: 40px;
width: 50px;
position: absolute;
z-index: 2;
background-color: #CCCCFF;
border: 1px solid #FFFF00;
}
</style>
<script type="text/javascript">
function showTip(e) {
var tipBox = document.getElementById("show");
tipBox.style.display = "block";
var event = e || window.event;
tipBox.style.top = event.clientX + "px";
tipBox.style.left = event.clientY + "px";
}
function hideTip() {
var tipBox = document.getElementById("show");
tipBox.style.display = "none";
}
</script>
</head>
<body>
<div class="map"></div>
<div class="city" onclick="alert('广东');" title="这是广东省,understand!" onmouseover="showTip(event)" onmouseout="hideTip()"></div>
<div id="show">信息:这是广东省</div>
</body>
</html>