IE theForm.submit() || Chrome Property submit of object is not a function 錯誤

摘要:IE theForm.submit() || Chrome Property submit of object is not a function 錯誤

先前在處理廠商的交付的模板時 , 做了一些表單的測試 , 

 

發現表單在 submit 時怎樣也沒有發生預期的作用 , 開了 console 後發現產生了如下的錯誤 , 

 

IE ( 8 )  跟 Chrome 顯示的錯誤不同 , 分別如下 :

 

Chrome : 

  1. Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function xxx.aspx:152
    1. __doPostBackxxx.aspx:152
  2. (anonymous function)

 

 

IE : 

 theForm.submit() 物件不支援此屬性或方法

 

仔細看了一下才發現該 submit 的按鈕 ID 也是 submit = = , 

 

讓 javascript 在處理 form.submit 方法時認為 submit 不是方法而是 Html DOM ...

 

只要把該 Submit 按鈕名稱改掉即可 ~