0
下面的代碼適用於Chrome,但不適用於IE和FireFox。請讓我知道如果我錯過了下面的東西。圖片預覽在IE和Firefox中無法正常工作Chrome
<div style="height:0px;overflow:hidden">
<input type="file" id="profileimgload" name="profileimgload" onchange="PreviewImage();" accept="image/*" capture="camera" />
</div>
<img src="../../images/static/default_images/user_default.png" id = "uploadImageBoxImg" width="150" height="150" />
<span class="btn btn-xs btn-primary" align="center" onClick="addprofileimage()" title="change profile picture">upload</span>
</div>
的JavaScript
//profile image upload
function addprofileimage()
{
$("#profileimgload").click();
}
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("profileimgload").files[0]);
alert("inside preview 2");
oFReader.onload = function (oFREvent) {
$("#uploadImageBoxImg").attr("src", oFREvent.target.result);
//document.getElementById("imageHiddenField").value = oFREvent.target.result;
};
};
你看到控制檯在IE?有些錯誤? –