使用实现的鼠标放上去显示悬浮层即弹出定位的div层。
代码:
-
<script language="javascript" src="jquery-1.4.2.min.js"></script>
-
<script>
-
function show(obj,id) {
-
var objDiv = $("#"+id+"");
-
$(objDiv).css("display","block");
-
$(objDiv).css("left", event.clientX);
-
$(objDiv).css("top", event.clientY + 10);
-
}
-
function hide(obj,id) {
-
var objDiv = $("#"+id+"");
-
$(objDiv).css("display", "none");
-
}
-
</script>
-
-
-
<!--http://
-
-
-
<div id="mydiv1" style="position:absolute;display:none;border:1px solid silver;background:silver;">
-
提示1效果
-
</div>
-
<div id="mydiv2" style="position:absolute;display:none;border:1px solid silver;background:silver;">
-
提示2效果
-
</div>
-
-
-
<a id="t1" onMouseOver="javascript:show(this,'mydiv1');" onMouseOut="hide(this,'mydiv1')">鼠标放上去1</a>
-
<br><br><br><br><br>
-
<a id="t2" onMouseOver="javascript:show(this,'mydiv2');" onMouseOut="hide(this,'mydiv2')">鼠标放上去2</a>
阅读(1250) | 评论(0) | 转发(0) |