<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
/**
* Get local image url from file domain
*/
function getFileUrl(sourceId) {
var url;
if (("MSIE")>=1) { // IE
url = (sourceId).value;
} else if(("Firefox")>0) { // Firefox
url = ((sourceId).(0));
} else if(("Chrome")>0) { // Chrome
url = ((sourceId).(0));
}
return url;
}
/**
* Show local image to the browser
*/
function preImg(sourceId, targetId) {
var url = getFileUrl(sourceId);
var imgPre = (targetId);
= url;
}
</script>
</head>
<body>
<form action="">
<input type="file" name="imgOne" onchange="preImg(,'imgPre');" />
<img src="" width="300px" height="300px" style="display: block;" />
</form>
</body>
</html>