Results 1 to 2 of 2

Thread: Display Script

  1. #1
    Join Date
    Mar 2007
    Location
    Scotland
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display Script

    Code:
    if (document.images) {
       var home1 = new Image();
       home1.src = "images/home.gif";
       var home2 = new Image();
       home2.src = "images/home2.gif";
    }
    
    function home_normal() {
    	if (document.images) {
    		document["home"].src = home2.src;
    	}
    }
    
    function home_out() {
    	if (document.images) {
    		document["home"].src = home1.src;
    	}
    }
    Can anyone tell me the javascript to swap with the image displaying code highlighted in red so that it displays text with a colour choice? If that makes sense.

  2. #2
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    Is this what you mean?

    Code:
    var imgRef = document.getElementById("myImg");
    imgRef.parentNode.replaceChild(
    	document.createTextNode("Text that replaced image!"),
    	imgRef
    	);

Bookmarks

Posting Permissions

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