<head runat="server">
<style type="text/css">#newPreview {
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)
}
</style>
<script>
//预览上传图片
function PreviewImg(imgFile)
{
if(imgFile.value.length>0){
var af="jpg,gif,png";
if(eval("with(imgFile.value)if(!/"+af.split(",").join("|")+"/ig.test(substring(lastIndexOf('.')+1,length)))1;"))
{
alert("允许上传的文件类型:\n"+af);
imgFile.createTextRange().execCommand('delete')
}else
{
var newPreview = document.getElementById("newPreview");
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
newPreview.style.width = "250px";
newPreview.style.height = "300px";
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type=file name=path onpropertychange="PreviewImg(this)"/>
<div id="newPreview"> </div>
</form> </body>
<style type="text/css">#newPreview {
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)
}
</style>
<script>
//预览上传图片
function PreviewImg(imgFile)
{
if(imgFile.value.length>0){
var af="jpg,gif,png";
if(eval("with(imgFile.value)if(!/"+af.split(",").join("|")+"/ig.test(substring(lastIndexOf('.')+1,length)))1;"))
{
alert("允许上传的文件类型:\n"+af);
imgFile.createTextRange().execCommand('delete')
}else
{
var newPreview = document.getElementById("newPreview");
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
newPreview.style.width = "250px";
newPreview.style.height = "300px";
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type=file name=path onpropertychange="PreviewImg(this)"/>
<div id="newPreview"> </div>
</form> </body>