The example in this article describes how to implement uploaded image preview using js. Share it with everyone for your reference. The specific implementation method is as follows:
if(document.all)//IE
{
imgFile.select();
Path = document.selection.createRange().text;
Document.getElementById("imgPreview").innerHTML="";
document.getElementById("imgPreview").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src="" path "")";//Use filter effects
}
else//FF
{
Path = imgFile.files[0].getAsDataURL();
Document.getElementById("imgPreview").innerHTML = "";
// document.getElementById("img1").src = path;
}
}
}
Call:
The operation effect is as shown below:
I hope this article will be helpful to everyone’s JavaScript programming design.