The following code doesn't work in Firefox and Chrome but works in IE. Can anyone tell me why it doesn't work in browser except IE with solution. Thanks in advance.
<html>
<head>
<script>
function hello()
{
var a=document.getElementById("upload").value;
alert(a);
document.getElementById("previewIMG").src=a;
document.getElementById("previewIMG").style.display="block";
}
</script>
</head>
<body>
<form name="img" enctype="multipart/form-data">
<input type="file" name="upload" id="upload" />
<input type="button" name="submit" value="Upload Me Now" onClick="javascript:hello();">
<img id="previewIMG" src="" style="display:none;" />
</form>
</body>
</html>