Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div , Frames and talking between them

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

I am trying to get a script to work that I have taken from a freebie site (javascriptkit.com). The script works fine, but now I want to change it slighty.

I am using a frameset (I have a top frame named top and undeath that left frame, called side and of course the main frame window which is not need here.

I would like to get the
Code:
div tag
to display in the top frame when I roll over the links in the side menu.

The code is provided below for the normal script, can anyone work out the communication needed to get the
Code:
div
to work in the other frame??

This goes in the head
Code:
<STYLE>

   /*  This is for Netscape 4.0+ broswsers so that the border will display.  If you want to modify the background color this 

is where you would do it for NS4.0+.  To modify the color for IE and NS6 do so in the style tag in the div below
   */

   .ttip {border:1px solid black;font-size:12px;layer-background-color:lightyellow;background-color:lightyellow}
  </STYLE>

<script>

//Script created by Jim Young ([URL unfurl="true"]www.requestcode.com)[/URL]
//Submitted to JavaScript Kit ([URL unfurl="true"]http://javascriptkit.com)[/URL]
//Visit [URL unfurl="true"]http://javascriptkit.com[/URL] for this script

//Set the tool tip message you want for each link here.
     var tip=new Array
           tip[0]='Click to discover the Groovy World of BigW1'
           tip[1]='Learn about BigW1s exciting Career to date'
           tip[2]='Providing exclusive 1-on-1 lessons in Singing, Keyboarding and Drumming'
           tip[3]='Listen to some of the Groove injected Tracks'
           tip[4]='Photos of the Groovemaster himself, BigW1'
           tip[5]='Get in contact with the BigW1'
 	   tip[6]='Find out where the BigW1 is playing next!!!!'
           
     function showtip(current,e,num)
        {
         if (document.layers) // Netscape 4.0+
            {
             theString=&quot;<DIV CLASS='ttip'>&quot;+tip[num]+&quot;</DIV>&quot;
             document.tooltip.document.write(theString)
             document.tooltip.document.close()
             document.tooltip.left=e.pageX+14
             document.tooltip.top=e.pageY+2
             document.tooltip.visibility=&quot;show&quot;
            }
         else
           {
            if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
              {
               elm=document.getElementById(&quot;tooltip&quot;)
               elml=current
               elm.innerHTML=tip[num]
               elm.style.height=elml.style.height
               elm.style.top=parseInt(elml.offsetTop+elml.offsetHeight)
               elm.style.left=parseInt(elml.offsetLeft+elml.offsetWidth+10)
               elm.style.visibility = &quot;visible&quot;
              }
           }
        }
function hidetip(){
if (document.layers) // Netscape 4.0+
   {
    document.tooltip.visibility=&quot;hidden&quot;
   }
else
  {
   if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
     {
      elm.style.visibility=&quot;hidden&quot;
     }
  } 
}
</script>

and this in the body
Code:
<div id=&quot;tooltip&quot; style=&quot;position:absolute;visibility:hidden;border:1px solid 

black;font-size:11px;layer-background-color:lightyellow;background-color:lightyellow;padding:0px&quot;></div>

This is the code to do with the link
Code:
<a href=&quot;&quot; onMouseover=&quot;showtip(this,event,'0')&quot; onMouseOut=&quot;hidetip()&quot;><img 

src=&quot;../images/intro.gif&quot; width=&quot;110&quot; height=&quot;20&quot;></a>

Hope someone can figure that out ok!

Cheers in advance

James
 
From a quick glance at what you are asking you will need to reference the frames collection in every place you call the DIV for example parent.top.document.tooltip1.write

Parent - being the master frame document
Top - being the name of your top frame

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top