javascript - Uncaught TypeError: Illegal invocation in Chrome or SCRIPT65535: Invalid calling object in IE when submit form -


I am getting an error type error: illegal voice in chrome or SCRIPT 65535: submit invalid call object form in IE

repeats the following markup error:

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Body & gt; & Lt; P & gt; Enter some text in the fields below, then press the "Submit form" button to submit the form. & Lt; / P & gt; & Lt; Form id = "myForm" verb = "form_action.asp" & gt; First name: & lt; Input type = "text" name = "fname" & gt; & Lt; Br> Last name: & lt; Input type = "text" name = "lname" & gt; & Lt; Br> & Lt; Br> & Lt; Input type = "button" onclick = "myfunction ()" value = "submit form" & gt; & Lt; / Form & gt; & Lt; Script & gt; Function myFunction () {var submit2 = myForm.submit; Submit2 (); } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

But instead of rows:

  var submit2 = myForm.submit; Submit2 ();  

directly to my form myForm.submit () then all the work without error.

Then how to fix the problem is clear to me, it is interesting to me why "indirect" form

myForm.submit () knows that the reference is my forum, but when we use it submit2 () If you are making tax calls, then there is no reference (global context), so it is giving an error.

To fix the error, you must set the contents of your content and call the submit2 () method.

Sample code

  var submit2 = myForm.submit; Submit2.call (MyForm);  

You can either use the call or apply to change the context.

More information on calls and applications:


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -