469,323 Members | 1,213 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

problem with setting image source dynamically

hi friends,i have a problem i m using this code for displaying image.this code is working fine when we run this code in internet Explorer but when the same page with this code i can in mozilla or firefox,the image is not display.i m very much frusteted,pls help me friend,this is the code i m using:
the javascript function:
Expand|Select|Wrap|Line Numbers
  1.   function loadIndividual(form) {
  2.     var gifName = form.vendorimageupload.value;
  3.     document.vendorimage.src = gifName;
  4.  
  5. }
and i call this function in this button:
Expand|Select|Wrap|Line Numbers
  1. <input type="file" name="vendorimageupload" id="vendorimageupload" onChange="loadIndividual(this.form)">
the image shold display in this :
Expand|Select|Wrap|Line Numbers
  1. <img name="vendorimage" width="147" height="135" id="vendorimage">
Sep 16 '07 #1
1 1363
gits
5,390 Expert Mod 4TB
hi ...

for refering the image-node you should use the standards-compliant dom method:

Expand|Select|Wrap|Line Numbers
  1. var img_node = document.getElementById('img_id');
  2.  
and then set the new img-src:

Expand|Select|Wrap|Line Numbers
  1. img_node.src = 'new_im_src.jpg';
kind regards
Sep 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Apple Sauce | last post: by
2 posts views Thread by anand | last post: by
4 posts views Thread by chsadaki | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.