F
faraz_mit
Hi
I posted the same issue but since I was using the old syntax of
"document.all", I took the focus away from the actual problem. I am
trying to change the image source on a click event but can't access
the image src using Internet explorer. Same code works fine in Firefox
and alerts the correct image src but I get undefined in Internet
explorer. I am using IE version 6.
I also tried document.images['im'], document.getElementById['im'], and
document['images']['im'] but none of them worked.
Here is the code I have:
/* in the head section I have the following simple javascript function
*/
function changeimgsrc(img_src) {
alert(document.getElementById('im').src);
document.getElementById('im').src = img_src;
}
/* in the body section I have the following nested div structure */
<div id="horizontal_container" >
<h3 class="horizontal_accordion_toggle">...</h3>
<div id="m1" class="horizontal_accordion_content">
<div id="m2" ><img id="im" width="360" src="images/
com_01_angle.gif" /></div>
....
<div ><a href="#"
onclick="changeimgsrc('cum_01_angel_blue.gif');">test</a> </div>
......
Thanks alot for your help,
Ross
I posted the same issue but since I was using the old syntax of
"document.all", I took the focus away from the actual problem. I am
trying to change the image source on a click event but can't access
the image src using Internet explorer. Same code works fine in Firefox
and alerts the correct image src but I get undefined in Internet
explorer. I am using IE version 6.
I also tried document.images['im'], document.getElementById['im'], and
document['images']['im'] but none of them worked.
Here is the code I have:
/* in the head section I have the following simple javascript function
*/
function changeimgsrc(img_src) {
alert(document.getElementById('im').src);
document.getElementById('im').src = img_src;
}
/* in the body section I have the following nested div structure */
<div id="horizontal_container" >
<h3 class="horizontal_accordion_toggle">...</h3>
<div id="m1" class="horizontal_accordion_content">
<div id="m2" ><img id="im" width="360" src="images/
com_01_angle.gif" /></div>
....
<div ><a href="#"
onclick="changeimgsrc('cum_01_angel_blue.gif');">test</a> </div>
......
Thanks alot for your help,
Ross