Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

document.getElementById src does not work

$
0
0

Hi this is the big question none seems to have an answer for, why in IE cant process a simple DOM line to swap an Image:

document.getElementById("idImage").src = path;

I get Error: 'document.getElementById(...)' is null or not an object.

I hope someone can give me an answer.

 

I use VS2008, win XP and IE 8 full updated.

I tried putting the script at bottom, refreshing image at onload of body with a function (does not work since is ajax), trying to remove and add later the img tag.

Img tag is inside a table, added same id and name, tried with differente name and id, leaving Src blank, with default pic.

I can change things in TR campoFoto with no problem.

When i call document.getElementById("idImage") i get and object using type of, but when i try to access anything from it, it fails.

 

 

<table>

                            <tr> 

                                <td width="40%" height="200" rowspan="3" align="center"

                                    valign="middle" id="campoFoto"  class="style1">

                                    <img id="fotografia" name="fotografia" alt="..." src="fotos/iconImg.png" height="200" width="130"/>

                                    <br />

                                    Foto del Empleado </td>

 

                                <td width="60%" id="campoNombre"  class="style1">&nbsp; Nombre y Apellido </td>

                            </tr>

 

                            <tr> 

                                <td id="campoDireccion"  class="style1">&nbsp; Direccion </td>

                            </tr>

 

                            <tr> 

                                <td id="campoEmail" class="style1">&nbsp; Email </td>

                            </tr>

                        </table>

 

 

IDEAS ???

Thanks, George

 

PD: I created a proyect apart to see if I could watch Ajax control update panel' script doing this, but could not find anything to help me.

 


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>