swap image in netscape

Discussion in 'Javascript' started by mr_burns, Apr 21, 2004.

  1. mr_burns

    mr_burns Guest

    hi, i am using the following to change an image from one to another.
    below is a stripped down version of the code i am using:

    function swaptheimage () {

    document.GetElementById('theimage').src = 'images/newimage.gif';


    this works fine in Internet Explorer, but in Netscape what would i
    replace 'document.GetElementById('theimage').src' with??? cheers

    mr_burns, Apr 21, 2004
    1. Advertisements

  2. mr_burns

    Grunken Guest

    Impresive it works in Internet Explorer :eek:)

    Remember : Java script is case sensitive!

    document.getElementById('theimage').src = 'images/newimage.gif';

    Kind Regards

    Grunken, Apr 21, 2004
    1. Advertisements

  3. A simpler and more reliable solution is

    document.images[ 'theimage' ].src = URL;


    Please don't use tabs to indent code when posting to newsgroups. Change
    them to spaces: between two and four.
    Michael Winter, Apr 21, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.