Console error solution for object is not a function, objectfunction

Source: Internet
Author: User

Console error solution for object is not a function, objectfunction

A bug was reported today, saying that the functionality of a page is useless. The error "object is not a function" is returned when you open the console.

It seems strange that this feature has never been updated. How can this problem suddenly happen? Mainstream browsers have all been tested before going online.

Although strange, it still solves the problem. The code finds that the name attribute of a radio object has the same name as a function name. The Code is as follows:

<body> <input type="radio" name="test" onclick="test();"/> <br/> <form action=""> <input type="radio" name="test" onclick="test();"/> </form> </body> <script type="text/javascript"> function test(){ alert("11"); }</script>

The function name is modified to solve the problem. But the root cause is not found, because this function name was previously used and can be used normally. Modify code
Onclick = "alert (test );"

The pop-up "object HTMLInputElement" is found, and the browser parses the test file into a dom object.

After the script test function, alert (test); is also a function.

Check the svn version and find that I added a form to package this radio when doing another function. An error occurred while parsing the browser.

Conclusion: there may be no problem with the code that is not necessarily changed, and the changes may cause other problems. Some browser compatibility problems are caused by code irregularities. You need to standardize the code to be written in the future!

If you know why the form browser is used for parsing, tell me. Grateful!


Python correction and error. function object is not subscriptable

Is the wei_matrix parameter that you passed in a level 3 matrix? If not, there is a problem.

Javascript problems always report: null is not null or an object

First:
Function newin () {and the following
Window. onload = newinit;
Newinit is inconsistent.

Second, check whether the space IDs in your page contain anchor1, anchor2, and anchor3. An error will be reported if either of them is missing.

Below is the code I tested. Try it.

<Script>
Function newinit (){
Alert ();
For (var I = 1; I <= 3; I ++ ){
Var anchor = document. getElementById ("anchor" + I );
Point (anchor, I );

}

}

Function point (anchor, I ){
Anchor. onclick = function (){

Alert ("my no. is" + I );
}
}

Window. onload = newinit;
</Script>
<Body onload = "newinit ()">
<Input type = 'button 'id = 'anchor1'> </input>
<Input id = 'anchor2'> </input>
<Input id = 'anchor3'> </input>
</Body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.