none
javascript RRS feed

  • Question

  • I am using javascript to change the source of an image. if I address the image by document.image_name.src='new address'. IE7 reports an error saying. document.image_name is nul of not an object.

    If I address the omage by using image_name.src='new address' IE7 changes the address. I have had this problem in IE6 as well all elements would not accept having document added in front of them. I had to leave the document section off. But this is a problem as the page needs to work in all browse and other browse insist on having the document section appended to the front.

    I have tired using the document.getElementById() method but this never fetches the element. Is this a problem that other people find, since I have seen from other source codes that the use of document does it work in IE6 and 7.

    Friday, December 15, 2006 4:08 PM

Answers


  • I use :
    document.getElementById("id_picture").src ="http://new_src"

    and I have no problem with any browser on windows or mac.

    --
    Mathieu Perceau
    Friday, December 15, 2006 6:31 PM

All replies


  • I use :
    document.getElementById("id_picture").src ="http://new_src"

    and I have no problem with any browser on windows or mac.

    --
    Mathieu Perceau
    Friday, December 15, 2006 6:31 PM
  • Thanks for that, that has made it work correctly.

    Friday, December 15, 2006 10:07 PM