Jump to content
Larry Ullman's Book Forums

Confused About Thelink And How To Get It And How To Get The Link


Recommended Posts

<ul>

    <li><a href="adelaide.html" class = "caption">Adelaide</a></li>

    <li><a href="alicesprings.html" class ="caption" id="central" Alice Springsarrow-10x10.png</a></li>

    <li><a href= broomearrow-10x10.png.html" class  ="caption" id="broome" >Broome</a>

    </li>

    <li><a href="cairns.html" class  ="caption" id="cairns" >Cairns</a>

    </li>

    <li><a href="canberra.html" class  ="caption" id="canberra" >Canberra</a>

    </li>

   

  </ul>

window.onload = rolloverInit;

 

function rolloverInit() {

     for (var i=0; i<document.links.length; i++) {

        var linkObj = document.links;

        if (linkObj.className) {

           var imgObj = document.getElementById(linkObj.className);

           if (imgObj) {

                setupRollover(linkObj,imgObj);

           }

        }

     }

}

 

function setupRollover(theLink,textImage) {

     theLink.imgToChange = textImage;

     theLink.onmouseout = function() {

        this.imgToChange.src = this.outImage.src;

     }

     theLink.onmouseover = function() {

        this.imgToChange.src = this.overImage.src;

     }

 

     theLink.outImage = new Image();

     theLink.outImage.src = textImage.src;

 

     theLink.overImage = new Image();

     theLink.overImage.src = "images/" + theLink.id + "Text.gif";

}

 

Link to comment
Share on other sites

Hey! Beyond the post title, could you add some more context as to what you're asking here? I thiiink the answer is that "theLink" is populated when the setupRollover() function is called, once for each link, but I'm not positive that's what you're asking about. Thanks!

Link to comment
Share on other sites

 Share

×
×
  • Create New...