解决方案 »
- 多线程
- ext htmleditor取值问题,或者为什么都不用htmleditor?
- 论坛不支持js代码,怎么办?
- JSP调用.net的WebService,标题长很长特别长!
- 请问有用struts2+tomcat+pluto成功布署过helloworld程序的朋友吗?
- 紧急处理:把.java编译成.class
- jsp初级问题,连接数据库出现问题.
- 求一个实现不同数据库进行数据同步操作的实现代码!100分帮顶有分~~~~
- 客户端如何自动安装jdk1.4?
- 请问怎样可以实现下拉选择框也可以让用户输入的????
- 初学jsp,第一个程序就出了问题
- <s:property/>取出的HTML代码被当做字符串显示
<html>
<head>
<script src="http://www.w3school.com.cn/jquery/jquery-1.11.1.min.js">
</script>
<script type="text/javascript">
function a(ele){
//var fileSize = ele.files[0].size;
var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
var fileSize = 0;
if (isIE && !ele.files) {
var filePath = ele.value;
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var file = fileSystem.GetFile (filePath);
fileSize = file.Size;
} else {
fileSize = ele.files[0].size;
}
var size = fileSize / 1024/1024;
alert('文件大小: '+size+'MB');
$("#size").val(fileSize);}
function b(){
/* alert("11111") */
var size1=$("#size").val();
/* alert(size1)*/
if(size1==""){
alert("文件不能为空")
return;
}else{
document.getElementById("form").action="fileInsertSave.do?size="+size1+"";
/* alert(document.getElementById("form").action) */
$("#form").submit();
}
}
</script>
</head>
<body>
<form action="" method="post" id="form" enctype="multipart/form-data">
<table class="user1" style="width: 100%">
<tr>
<td class="td2" width="25%" align="left"><font>*</font>上传文件:</td>
<td class="td3" width="25%" align="left">
<input type="file" name="file" id="file" onchange="a(this)"/>
<input type="hidden" id="size" name="file_size" />
</td>
</tr>
<tr>
<td class="sub" width="100%" colspan="4" align="center" height="20">
<input class="submit" type="button" onclick="b()" value=" 上 传 " />
</td>
</tr>
</table>
</form>
</body>
</html>