471,881 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,881 software developers and data experts.

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;
  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 1417
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');
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
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.