I'm trying to create an image preview function so that my users can
preview images before they upload them. I've got my example working
locally on both Firefox and IE, and from the webserver in IE. However,
when I try to access the example via a webserver and Firefox, it
doesn't work. Any help with this would be greatly appreciated.
(Code listed below:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script language=Javasc ript>
<!--
function previewImage()
{
var previewImage = document.f.colo rtheme.value;
var spaceMatch = / /gi;
var slashMatch = /\\/gi;
previewImage = previewImage.re place(spaceMatc h, "%20");
previewImage = previewImage.re place(slashMatc h, "/");
previewImage = "file:///" + previewImage;
document.getEle mentById('PREVI EW').src = previewImage;
return false;
}
//-->
</script>
<html>
<head>
<title>PREVIE W-IMAGE (UPDATED-1123)</title>
</head>
<body>
<h5>PREVIEW IMAGE onChange</h5>
<table border="1" bgcolor="gold">
<tr>
<td>
<form method="post" name="f" id="f"
action="form_dr opdown_image_se lect_rmk_UNIVER SAL.html">
<!--
visit our website: http://www.angdatingdaan.org --- really cool
email me: romack@linuxmai l.org
-->
Select image:<br>
<input type="file" name="picture" maxlength="1024 " value=""
onchange="previ ewImage()" id="colortheme" >
</center>
</form>
</td>
<td valign="center" width="300" align="center"> <img
src="http://images.animatio nfactory.com/animations/animals/rodents/mouse_quiet_shh/mouse_quiet_shh _sm_nwm.gif"
border="0" id="PREVIEW" alt="preview image"/></td>
</tr>
</table>
</body>
</html>
preview images before they upload them. I've got my example working
locally on both Firefox and IE, and from the webserver in IE. However,
when I try to access the example via a webserver and Firefox, it
doesn't work. Any help with this would be greatly appreciated.
(Code listed below:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script language=Javasc ript>
<!--
function previewImage()
{
var previewImage = document.f.colo rtheme.value;
var spaceMatch = / /gi;
var slashMatch = /\\/gi;
previewImage = previewImage.re place(spaceMatc h, "%20");
previewImage = previewImage.re place(slashMatc h, "/");
previewImage = "file:///" + previewImage;
document.getEle mentById('PREVI EW').src = previewImage;
return false;
}
//-->
</script>
<html>
<head>
<title>PREVIE W-IMAGE (UPDATED-1123)</title>
</head>
<body>
<h5>PREVIEW IMAGE onChange</h5>
<table border="1" bgcolor="gold">
<tr>
<td>
<form method="post" name="f" id="f"
action="form_dr opdown_image_se lect_rmk_UNIVER SAL.html">
<!--
visit our website: http://www.angdatingdaan.org --- really cool
email me: romack@linuxmai l.org
-->
Select image:<br>
<input type="file" name="picture" maxlength="1024 " value=""
onchange="previ ewImage()" id="colortheme" >
</center>
</form>
</td>
<td valign="center" width="300" align="center"> <img
src="http://images.animatio nfactory.com/animations/animals/rodents/mouse_quiet_shh/mouse_quiet_shh _sm_nwm.gif"
border="0" id="PREVIEW" alt="preview image"/></td>
</tr>
</table>
</body>
</html>
Comment