PDA

View Full Version : Display Script



Aidanx
06-30-2007, 09:23 PM
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. :confused:

Trinithis
07-01-2007, 03:15 AM
Is this what you mean?



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