在火狐,谷歌好使,在ie就出错了
jquery.form.js版本2.77 jquery.min.js版本1.4.2
function changeFile() {
document.form1.file.click();
document.form1.file.value = document.getElementById("form1").file.value;
}
$(document).ready(function() {
var options = {
url : "a.action",//跳转到相应的Action
type : "POST",//提交方式
dataType : "script",//数据类型
success : function(msg) {//调用Action后返回过来的数据
var data = msg.split("#");
//alert(data[0]+"and"+data[1]);
}
};
//$("#form1").ajaxSubmit(options);//绑定页面中form表单的id
window.setTimeout($('#form1').ajaxSubmit(options),0);
return false;
});
}
<form id="form1" name="form1" method="post"
enctype="multipart/form-data">
<table border="1" width="706px" align="center">
<tr height="400px">
<td valign="top">
<div id="showImage"></div>
<div id="uploaddiv" style="margin-top: 260px" align="center">
<input type="file" name="file" id="upload"
οnchange="uploadImage()" style="display: none" />
<a href="javascript:changeFile();"><img alt="选择图片"
src="checkImg.png" border="0px" >
</a>
</div>
</td>
</tr>
</table>
</form>