<script>
alert(document.fileSize/1024+"Kb")
</script>
alert(document.fileSize/1024+"Kb")
</script>
解决方案 »
- 怎样用JS动态改变frame框架里一个子frame的src 急!!
- 关于ajax取json字符串的问题
- 动态建立的可编辑的iframe怎样对它的document添加onclick事件?
- 各位高手来看看我这个定时有什么问题,老是不执行
- 关于JS生成的隐藏值的问题
- onblur触发的显示问题,急急急!!!!!!!
- 怎样用javascript实现这样的功能??[求助]
- js error:dom exception 11 400 bad request!非常急!!!
- 好迷茫,求前端技术大神指导!!!
- webUploader上传图片在Safari上兼容问题
- 如何用正则表达式检查字符串的长度?谢谢。
- 怎样先将所有的图片下载
function mysubmit()
{
theform=document.form1;
if(theform.picture.value=="")
{
alert("请点击浏览按钮,选择您要上传的jpg或gif文件!")
theform.picture.focus;
return (false);
}
else
{
str= theform.picture.value;
strs=str.toLowerCase();
lens=strs.length;
extname=strs.substring(lens-4,lens);
if(extname!=".jpg" && extname!=".gif")
{
alert("请选择jpg或gif文件!");
return (false);
}
}
if(img1.width>195 || img1.height>100)
{
alert("您上传的图片尺寸太大,这样会影响美观!请裁剪后再上传!")
return(false);
}
return true;
}
</script>
<form name=form1 onsubmit="return mysubmit()">
<input type="file" name="picture" onpropertychange="img1.src=this.value;">
<input type="submit" value="上传" name="B1" style="font-size: 12">
</form>
<img id="img1">
<body bgcolor=#FFFBE7>
<center>
<form name="form1" action=process.asp method=post enctype="multipart/form-data" onsubmit="return check()">
<table border=1 width=70% style="margin-top:6em" >
<tr>
<td colspan=2 align=center>请贴上你的相片(<20kb)</td>
</tr>
<tr>
<td>相片文件名:</td><td><input type=file name=mefile></td>
</tr>
<tr>
<td align=center colspan=2><input type=submit value="发送"> <input type=reset value="取消"></td>
</tr>
</table>
</form>
</center>
</body>
<script>
var fso;
function check(){
var errMsg,filespec=document.all.mefile.value;
if(filespec==""){alert("请选择文件,谢谢");return false;}
errMsg="你禁止了FSO,请刷新页面,谢谢";
try{
if(fso==null){
alert("请允许启用FSO检查文件大小,谢谢");
fso= new ActiveXObject("Scripting.FileSystemObject");
}
errMsg="文件过大,请重新选择,谢谢";
if(fso.GetFile(filespec).size<20*1024)return true;
}catch(e){}
alert(errMsg);return false;
}
</script>
</html>