...

View Full Version : body onLoad/tooltip display difficulties



greasonwolfe
11-02-2004, 12:26 AM
In general this script works, however I tried to set up the display of the default tooltip message in the body onLoad and it doesnt seem to work. The only thing I can think of is that the div that the tooltip is displayed in hasn't been defined yet, but I am not really sure. Any suggestions?


<head>
<STYLE>
.ttip {border:0px solid black;font-size:15px;}
</STYLE>

<script language="javascript">

var tip=new Array
tip[0]='<font color="#ffffff">Raven Claudia Nightshade-Wolfe (SN RavenCNightwlf)</font>'
tip[1]='<font color="#ffffff">Greason Wolfe (SN GreasonNightwlf)</font>'
tip[2]='<font color="#ffffff">Sasha T. Nightwolfe (SN SashaNightwlf)</font>'
tip[3]='<font color="#ffffff">Dorien Grea Nightwolfe (SN DorienNightwlf)</font>'
tip[4]='<font color="#ffffff">Howling Wolfe Lodge</font>'
tip[5]='<font color="#ffffff">To navigate, please run the mouse pointer over the image and follow the link you wish to explore</font>'


function showtip(current,e,num)
{
if (document.layers) // Netscape 4.0+
{
theString="<DIV CLASS='ttip'>"+tip[num]+"</DIV>"
document.tooltip.document.write(theString)
document.tooltip.document.close()
document.tooltip.left=70
document.tooltip.top=10
document.tooltip.visibility="show"
}
else
{
if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
{
elm=document.getElementById("tooltip")
elml=current
elm.innerHTML=tip[num]
elm.style.height=elml.style.height
elm.style.top=parseInt(10)
elm.style.left=parseInt(70)
elm.style.visibility = "visible"
}
}
}
</script>
</head>

<body bgcolor="#000000" leftmargin="0" topmargin="0" onLoad="showtip(this,event,'5')">
<div id="tooltip" style="width:310;position:absolute;visibility:hidden;border:0px solid black;font-size:15px;padding:1px"></div>

Willy Duitt
11-02-2004, 12:51 AM
Used as you are in the body onload the this keyword is referring to the body element not your division...

<body bgcolor="#000000" leftmargin="0" topmargin="0" onLoad="showtip(this,event,'5')">


Try changing this to the id of you division and using quotes...

.....Willy

greasonwolfe
11-02-2004, 01:02 AM
Hrm. . . that didnt seem to help, but I am still fiddling with it. What if I take the "hidden" tag off the visibility when the div first comes up, I bet that would help, wouldn't it? All I would have to do then is make a few positioning adjustments and it would be good to go. I really shouldn't try to write this stuff when I haven't gotten a good night's sleep. Thanks for the help though :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum