PDA

View Full Version : image path display image preview when the page loads


wanye
10-31-2002, 04:09 PM
hi, for example if theres a image path in a file field, how do i display the image preview when the page loads..?

eg. c:/image.jpg

<image preview here>

beetle
10-31-2002, 06:03 PM
I'm not sure what event is best for this, I was successful using onBlur<form name="coords">
<input type="file" onBlur="document.getElementById('preview').src = 'file://' + this.value;" />
<img id="preview" width="50" height="50" />
</form>You can try some of the other events (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp) that input type=file supports.

Or, you could skip the event and have a button/link that the user must press to get the preview...