I am working with a form. There is a button to upload images to the server. Once the image is uploaded, a form field gets the image file name.
I also have an <img scr>
which shows a default image.
What I need is that when the user uploads an image, this image should be shown instead of the default image.
This is the form field that receives the uploaded image file name:
<input type="text" name="imagen" id="imagen" value="" size="32" onInput ="javascript:reloadpic();">
And this is the script that should be launched:
<script type="text/javascript">
<!--
function reloadpic()
{
alert ("ha cambiado");
var timestamp = new Date().getTime();
var image = "http://../platos/"+document.getElementById("imagen").value;
document.images["imagenplato"].src = image;
setTimeout("reloadpic();", 1000);
}
-->
</script>
But it is never launched. Any help is welcome.