Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript new Image or new Image()

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #30193
    Nimerion
    Member

    Hi there..
    I’m new at javascript and I’ve just watched a tutorial about the rolloers..

    window.onload = rollInit;

    function rollInit(){
    for(var i=0; i if(document.images.parentNode.tagName == "A"){
    setupRoll(document.images
    );
    }
    }
    }

    function setupRoll(thisImage){
    thisImage.outImage = new Image();
    thisImage.outImage.src = thisImage.src;
    thisImage.onmouseout = rollOut;

    thisImage.overImage = new Image();
    thisImage.overImage.src = "images/" + thisImage.id + "_on.gif";
    thisImage.onmouseover = rollOver;
    }

    function rollOut(){
    this.src = this.outImage.src;
    }

    function rollOver(){
    this.src = this.overImage.src;
    }

    In this example, I’ve first realized, that in the setupRoll function where I have “new Image();” if i write “new Image;” is the absolutely the same thing.

    But I can’t find anywhere an explanation of this..

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.