June 20, 201115 yr Below is the programme to upload an image and display the preview on upload without page refresh.Its working fine in IE but giving problem in mozilla Firefox.please help me with this. <script type="text/javascript"> var timerID = null; var delay = 500; function swap(filename) { clearTimeout(timerID); if (document.layers) { filename = filename.replace(/\\/g,'/'); document.layers['layer1'].document.images['image1'].src='file://'+filename;} else{document.images['image1'].src='file://'+filename;} } function StartTimer() { if (document.form.image.value > "") { swap(document.form.image.value); } else{timerID = self.setTimeout('StartTimer()', delay); } } </SCRIPT> <body> <form name="form"> <p> </p> <p><img border="0" name="image1" src="default_user.jpg" width="100" height="110" /></p> <input type="file" name="image" size="13" onMouseDown="document.form.reset();" onClick="StartTimer()" /> <layer name="layer1" top="50" width="115" height="115" id="layer1"></layer> </form>
June 20, 201115 yr Author just run that programe in both IE and firefox.see what happens........waiting for reply.
Create an account or sign in to comment