<form name="sendmail" id="idFrmSendmail" method="post" enctype="multipart/form-data"
我想如果是要上传文件我就用enctype="multipart/form-data" 否则就用application/x-www-form-urlencoded,于是我在一个function里面修改 document.sendmail.enctype="..."//根据判断到是否上传文件而使用相应的enctype,在那个function中alert出来看到的结果是对的,但是提交请求中的enctype却错误了: 解决方案:
sendmail.encoding = 'application/x-www-form-urlencoded';
JS可以对FORM的各个属性重赋值
var vForm = document.forms[0]; vForm.method = ""; vForm.method = ""; vForm.encoding = ""; vForm.action= ""; vForm.target= ""; vForm.submit(); |
|