Topic awaiting preservation: Dynamic image upload preview |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: Careywood, Idaho, USA |
posted 08-23-2005 17:17
Hello Everyone! code: <td class="even">Photos: <td class="odd" valign="top"> <script type="text/javascript"> function updatePreviewImage(num) { file = document.getElementById('pic'+num); image = document['previewImage'+num]; image.src = 'file://' + file.value; image.width = 100; image.height = 75; return true; } </script> <b>Image Files:</b><br /><br /> <ol> <li> <input name="pic0" id="pic0" type="file" value="" onChange="updatePreviewImage(0);" /></li> <li> <input name="pic1" id="pic1" type="file" value="" onChange="updatePreviewImage(1);" /></li> <li> <input name="pic2" id="pic2" type="file" value="" onChange="updatePreviewImage(2);" /> </li> <li> <input name="pic3" id="pic3" type="file" value="" onChange="updatePreviewImage(3);" /> </li> <li> <input name="pic4" id="pic4" type="file" value="" onChange="updatePreviewImage(4);" /> </li> <li> <input name="pic5" id="pic5" type="file" value="" onChange="updatePreviewImage(5);" /> </li> <li> <input name="pic6" id="pic6" type="file" value="" onChange="updatePrevi ewImage(6);" /> </li> <li> <input name="pic7" id="pic7" type="file" value="" onChange="updatePreviewImage(7);" /> </li> <li> <input name="pic8" id="pic8" type="file" value="" onChange="updatePreviewImage(8);" /> </li> <li> <input name="pic9" id="pic9" type="file" value="" onChange="updatePreviewImage(9);" /> </li> </ol> <em></em> </td> <td valign="top" class="odd"><b>Image Previews:</b><br /><br /><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 1:</em><br /><img name="previewImage0" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 2:</em><br /><img name="previewImage1" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 3:</em><br /><img name="previewImage2" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 4:</em><br /><img name="previewImage3" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 5:</em><br /><img name="previewImage4" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 6:</em><br /><img name="previewImage5" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 7:</em><br /><img name="previewImage6" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 8:</em><br /><img name="previewImage7" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 9:</em><br /><img name="previewImage8" src="/images/iconNoImage.png"></div><div style="width:100px; height:90px; float:left; text-align:center;"><em>Photo 10:</em><br /><img name="previewImage9" src="/images/iconNoImage.png"></div></td> </tr>
|
Bipolar (III) Inmate From: UK |
posted 08-23-2005 19:21
That's quite cool in a way. code: Security Error: Content at http://safarri.com/submit-step-2-cat-99.ati may not load or link to file:///C:%5CDocuments%20and%20Settings%5CBlah%5CDesktop%5Cblah.gif.
|
Nervous Wreck (II) Inmate From: Careywood, Idaho, USA |
posted 08-23-2005 19:46
Thanks for telling me that it works in IE. That is a very important point! |
Maniac (V) Inmate From: Sthlm, Sweden |
posted 08-23-2005 20:31
I've done that before and there should be no problem with security errors... On the other hand FF did not exist when I did it... code: data = document.frmSave.fileSave.value; //imgPos holds which image to replace with the new path, orig it's a 1x1px transp gif document.images[imgPos].src = data; //imgLink holds which link should link to the new image document.links[imgLink].href = data;
|
Nervous Wreck (II) Inmate From: Careywood, Idaho, USA |
posted 08-23-2005 21:34
DMS: |
Nervous Wreck (II) Inmate From: Careywood, Idaho, USA |
posted 09-21-2005 02:28
Sorry for the length of time since my last post. |