萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> jquery鼠標放上去顯示懸浮層即彈出定位的div層

jquery鼠標放上去顯示懸浮層即彈出定位的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://www.ablanxue.com/prone_3421_1.html-->    <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> 
copyright © 萬盛學電腦網 all rights reserved