Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change image on [input type=file] change 1

Status
Not open for further replies.

MikeT

IS-IT--Management
Feb 1, 2001
376
US
I have an [input type=file name=pic] on a page, and when I change its value, I want the image a browsed for to appear on the page. This page is for local use only, so the images are always available.
Is this possible without refreshing?
 
Hi MikeT,

what do you mean with " I change its value".
You have an input type that gets an image.How can you change this value so that you can change the image?
Hug
===================
* Marta Oliveira *
===================
marta100@aeiou.pt
-------------------
CPC_TA- Braga
-------------------
Portugal
===================
 
OK- Lets say I click the Browse button, then I browse to picture I want, click OK, then that picture should appear on the page.
 
In IE, you could do this:
Code:
<script>
function chgImg(field){
  document.all(&quot;preview&quot;).innerHTML='<img src=&quot;'+field.value+'&quot;>';
}
</script>
<input type=&quot;file&quot; onchange=&quot;chgImg(this)&quot;>
<div id=&quot;preview&quot;></div>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top