<html>
<head>
<title>
ToolTip Perfect
</title>
<script language="javascript">
function sentense()
{
var ses="1+2*3+5*(3+4)";
var res=eval(ses);
alert(res);
}
function moveDIV()
{
var objD=document.getElementById('d');
objD.style.position='absolute';
var nowtop=document.getElementById('d').style.top;
var nexttop=String(eval((isNaN(parseInt(nowtop))?0:parseInt(nowtop))+30));
/*alert(document.body.clientHeight);*/
if(parseInt(nexttop)+parseInt(objD.style.height)>document.body.height)
{
alert(screen.width+'*'+screen.height);
}
else
{
objD.style.top=nexttop+'px';
objD.style.left='20px';
}
}
</script>
<style type="text/css">
.trans_msg { FILTER: alpha(opacity=100,enabled=1) revealTrans(duration=.2,transition=1) blendtrans(duration=.2) }
</style>
<script language="javascript">
//
var rT=true;
var bT=true;
var tw=600;
var endaction=false;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
if(ns4||ns6||ie4)
{
if(ns4) toolTipSTYLE = document.toolTipLayer;
else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
if(ns4) document.captureEvents(Event.MOUSEMOVE);
else
{
toolTipSTYLE.visibility = "visible";
toolTipSTYLE.display = "none";
}
document.onmousemove = moveToMouseLoc;
}
}
function toolTip(msg, fg, bg)
{
if(toolTip.arguments.length < 1) // hide
{
if(ns4)
{
toolTipSTYLE.visibility = "hidden";
}
else
{
//
if (!endaction) {toolTipSTYLE.display = "none";}
if (rT) document.all("msg1").filters[1].Apply();
if (bT) document.all("msg1").filters[2].Apply();
document.all("msg1").filters[0].opacity=0;
if (rT) document.all("msg1").filters[1].Play();
if (bT) document.all("msg1").filters[2].Play();
if (rT){
if (document.all("msg1").filters[1].status==1 || document.all("msg1").filters[1].status==0){
toolTipSTYLE.display = "none";}
}
if (bT){
if (document.all("msg1").filters[2].status==1 || document.all("msg1").filters[2].status==0){
toolTipSTYLE.display = "none";}
}
if (!rT && !bT) toolTipSTYLE.display = "none";
//----------------------
}
}
else // show
{
if(!fg) fg = "#000000";
if(!bg) bg = "#ffffe1";
var content =
'<table id="msg1" name="msg1" border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"
class="trans_msg"><tr><td>' +
'<table border="0" cellspacing="0" cellpadding="3" bgcolor="' + bg +
'"><tr><td><textarea style="width:' + tw + ';overflow-y:visible;font-family:Arial; font-size:12px; color:' +
fg +
';background-color:' + bg +';border-style:none" readonly>' + msg +
' /;</textarea></td></tr></table></td></tr></table>'+
'<iframe id="iframeBG" src="" style="position:absolute; visibility:inherit; top:0px;left:0px;z-index:-
1;filter:Alpha(opacity=0)"></iframe>';
if(ns4)
{
toolTipSTYLE.document.write(content);
toolTipSTYLE.document.close();
toolTipSTYLE.visibility = "visible";
}
if(ns6)
{
document.getElementById("toolTipLayer").innerHTML = content;
toolTipSTYLE.display='block'
}
if(ie4)
{
document.all("toolTipLayer").innerHTML=content;
toolTipSTYLE.display='block'
//
var cssopaction=document.all("msg1").filters[0].opacity
document.all("msg1").filters[0].opacity=0;
if (rT) document.all("msg1").filters[1].Apply();
if (bT) document.all("msg1").filters[2].Apply();
document.all("msg1").filters[0].opacity=cssopaction;
if (rT) document.all("msg1").filters[1].Play();
if (bT) document.all("msg1").filters[2].Play();
//----------------------
document.all("iframeBG").style.width=document.all("toolTipLayer").scrollWidth;
document.all("iframeBG").style.height=document.all("toolTipLayer").scrollHeight;
}
else
{
document.getElementById("iframeBG").style.width=document.getElementById("toolTipLayer").scrollWidth;
document.getElementById("iframeBG").style.height=document.getElementById("toolTipLayer").scrollHeight;
}
}
}
function moveToMouseLoc(e)
{
if(ns4||ns6)
{
x = e.pageX;
y = e.pageY;
}
else
{
x = event.x + document.body.scrollLeft;
y = event.y + document.body.scrollTop;
}
var layHeight=0;
var larWidth=0;
if(ie4)
{
layHeight=document.all('toolTipLayer').clientHeight;
layWidth=document.all('toolTipLayer').clientWidth;
}
else
{
layHeight=document.getElementById('toolTipLayer').clientHeight;
layWidth=document.getElementById('toolTipLayer').clientWidth;
}
if(x+offsetX+layWidth>(document.body.scrollWidth>document.body.clientWidth?
document.body.scrollWidth:document.body.clientWidth))
{
toolTipSTYLE.left = x - offsetX-layWidth;
}
else
{
toolTipSTYLE.left = x + offsetX;
}
if(y + offsetY+layHeight>(document.body.scrollHeight>document.body.clientHeight?
document.body.scrollHeight:document.body.clientHeight))
{
toolTipSTYLE.top = y - offsetY-layHeight;
}
else
{
toolTipSTYLE.top = y + offsetY;
}
return true;
}
</script>
<div id="toolTipLayer" style="VISIBILITY:hidden; POSITION:absolute;">Test Layer</div>
<script language="javascript">
initToolTips()
</script>
</head>
<body onMouseOver="toolTip('Where to find block notes: /r/n Block notes are available in WebServer. /r/n; Hi, this is the Tooltip! )">
<IE:CLIENTCAPS ID="oClientCaps" />
<input type=button value="test" οnclick="sentense()"></input>
<div id="d" style="postion:absolute; border:1px solid
black;top:20px;left:0px;height:200;width:500"></div>
<input type="button" value="Hit" οnclick="moveDIV()">
<select type="" id="fsdfsdfsdf>
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>
</body>
</html>