在javascipt中不能修改form的enctype吗?

来源:百度文库 编辑:神马文学网 时间:2024/05/23 19:38:50
   
  我想如果是要上传文件我就用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();