Hello all,
I have some simple JavaScript code that changes an image based on some user action (i.e. pushing a button).
I sniff the broiwsers and, in case of IE5+, I use GetElementById and then change the object.src, pointing to the proper gif or jpg.
The code is:
if ( document.getElementById ) // IE5+ & Gecko
{
if ( document.getElementById( id ).innerHTML != null )
{
document.getElementById( id ).innerHTML.src = url;
}
}
else if ( document.getElementById ) // IE5+ & Gecko
{
if ( document.getElementById( id ) != null )
{
document.getElementById( id ).src = url;
}
}
else if (document.all) // IE4
{
if ( document.all[ id ] != null )
{
document.all[ id ].src = url;
}
}
else // Netscape 4
{
if ( document.images[ id ] != null )
{
document.images[ id ].src = url;
}
}
Very basic JavaScript... should it be...
In fact, it works fine with IE5 or IE6 and Netscape, but does not work with IE7.
Is there anything regarding GetElementById and IE7 ?
Or is my piece of script wrong ?
Pelase, help... :-|