Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2004
    Location
    near the only active volcano in the continental US
    Posts
    409
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Question body onLoad/tooltip display difficulties

    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>

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Nov 2004
    Location
    near the only active volcano in the continental US
    Posts
    409
    Thanks
    6
    Thanked 2 Times in 2 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •