View Full Version : body onLoad/tooltip display difficulties

11-01-2004, 11:26 PM
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?

.ttip {border:0px solid black;font-size:15px;}

<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>"
if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
elm.style.visibility = "visible"

<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-01-2004, 11:51 PM
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...


11-02-2004, 12: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