在tomcat如何用javascript获得上传文件大小? 这是客户端代码,与Tomcat没有任何关系。把你的浏览器安全性降低即可 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把ie安全性降至最低。起用所有ActiveX,问题依然如故! 你调用错了,改成这样<html><head><script language=javascript>function getfile(){ var fso,f,s; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFile(document.formname.file.value); s = f.Name + " on Drive " + f.Drive + "<br>"; s += "文件建立的日期: " + f.DateCreated + "<br>"; s += "最后打开的时间: " + f.DateLastAccessed + "<br>"; s += "最后修改的时间: " + f.DateLastModified + "<br>"; s += "文件大小: "+f.size +" bytes" + "<br>"; s += "文件属性: "+f.attributes +"<br>"; document.write(s);} </script></head><body><form name=formname action=filesize.htm enctype="multipart/form-data" method="post" ><input name=file type=file><input type="button" name="fileupb" value="送出" onclick="getfile()"></form></body></html> to 大花猫 此代码放在tomcat服务器上依然报错! s += "文件大小: "+f.size +" bytes" + "<br>";---------------->s += "文件大小: "+f.fileSize +" bytes" + "<br>"; 试试看 to 楼主----我试过,完全可以的。你需要把internet选项中的“安全”页的activeX控件启用 <img src="http://community.csdn.net/images/CSDN_logo.GIF" id=aa><input type=button onclick="alert(document.all.aa.fileSize)" value="ss"><input type=file onchange="document.all.aa.src=this.value">仅仅限于图片 初学代码多个if嵌套错误,求调试 进来看看吧,字符串遍历问题 >16 位数值运算 滚动字幕无缝连接 用梅老大的MzTreeView 1.0,为什么nodeClick(id)方法中的id不能是最末节点? 图片走马灯为什么不动 我代码哪有问题?请高手赐教! '100610~|10^~21#4||5'取出里面的值不会取。 哪有JavaScript的帮助文档啊? 怎么得到listbox值的个数? 我在iframe里包含进任一一个网页,请问我怎么得到它的高度和宽度,style里没有指定width,height 谁有可以通过鼠标拖动表头改变表格列宽度的代码?谢谢 求一段javascript代码的思路
<html>
<head>
<script language=javascript>
function getfile(){
var fso,f,s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFile(document.formname.file.value);
s = f.Name + " on Drive " + f.Drive + "<br>";
s += "文件建立的日期: " + f.DateCreated + "<br>";
s += "最后打开的时间: " + f.DateLastAccessed + "<br>";
s += "最后修改的时间: " + f.DateLastModified + "<br>";
s += "文件大小: "+f.size +" bytes" + "<br>";
s += "文件属性: "+f.attributes +"<br>";
document.write(s);}
</script>
</head>
<body>
<form name=formname action=filesize.htm enctype="multipart/form-data" method="post" >
<input name=file type=file>
<input type="button" name="fileupb" value="送出" onclick="getfile()">
</form>
</body>
</html>
----
我试过,完全可以的。你需要把internet选项中的“安全”页的activeX控件启用
<input type=button onclick="alert(document.all.aa.fileSize)" value="ss">
<input type=file onchange="document.all.aa.src=this.value">仅仅限于图片