JavaScript---Tooltip提示(很早以前写的)

截图 :

 

代码 :

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
 <HEAD>
  <TITLE>提示窗</TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <style>
.aaa {
	          background-color :#999 ;
	          text-align : left ;
	          margin : 0 auto ;
	          padding : 0px ;
	          font-size : 13px ;
	          font-family : arial ;
	          color : white ;
	          width : 760px ;
	          height : 32px ;
	          line-height : 32px ;
	          border : none ;
	          font-weight : bold ;
	         cursor : pointer ;
	        
	       }



	#toolTip {
		    border : 1px solid #4e514e ;
		    width : 420px ;
		    height : 32px ;
		    line-height : 32px ;
		    display : none ;
		    position : absolute ;
		    font-size : 12px ;
		    font-family : arial ;
		    background-color : #FFFF77 ;
		    color : black ;
		    padding : 0px ;
		    margin : 0px ;
			text-align : center ;
		} 
  </style>



  <script>
var $ = function(sId){
	return ('string' == typeof sId) ? document.getElementById(sId) : sId ; 
}
function isIE(){
	 return (document.all && window.ActiveXObject && !window.opera) ? true : false ;
}

var createToolTip = function(){
	$("aaa").onmouseover = function(ev){
	var ev = ev || window.event ;
	if(isIE()){
		$("toolTip").style.filter = 'alpha(opacity=75)' ;
	}else{
		$("toolTip").style.opacity = 0.75 ;
	 }
	$("toolTip").style.top = ev.clientY + 'px' ;
	$("toolTip").style.left = ev.clientX + 'px' ;
	$("toolTip").style.display = 'block' ;
  }
	$("aaa").onmousemove = function(ev){
	var ev = ev || window.event ;
	$("toolTip").style.top = ev.clientY + 10 + 'px' ;
	$("toolTip").style.left = ev.clientX + 5 + 'px' ;
 }
	$("aaa").onmouseout = function(){
	$("toolTip").style.display = 'none' ;
	}
}
	window.onload = createToolTip ;
  </script>
 </HEAD>

 <BODY>
<div id="aaa" class="aaa">这是测试数据</div>
<div id='toolTip'>toolTip提示条</div>
 </BODY>
</HTML>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值