js实现toolTip

曾皓
2023-12-01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
var oPopup = window.createPopup();
function richToolTip(){ 

var showStr = '<div style="position: absolute; top:0; left:0; width:100%; height:100%; border:2px solid black; font:normal 10pt tahoma; padding:10px" ><b style="font-size:9pt">显示ToolTip</div>'; 
   var lefter = event.offsetY;
   var topper = event.offsetX;
oPopup.document.body.innerHTML = showStr; 
    oPopup.show(topper, lefter, 100, 60, window.document.getElementById("sp1"));

}</script>
</head><body>
<div id="sp1" οnmοuseοver="richToolTip();" οnmοuseοut="oPopup.hide();">把光标移动到我上面</div>
</body>
</html>
 类似资料: