Console Error object is not a function solution _ basics

Source: Internet
Author: User

Today feedback a bug, said a page function can not be used. Open the console and find an error: object is not a function.

It feels strange that the function of this piece has not been moved, how could it suddenly go wrong? The mainstream browser has been tested in the online.

Although strange, but still solve the problem. Look at the code that finds a radio object with the Name property and a function name duplicate. 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 ("one"); 
}
</script>

The function name was modified to solve the problem. But there is no root cause, because this function is the same as before, it can be used normally. Modify Code
onclick= "alert (test);"

Discovery pops up "Object Htmlinputelement" and the browser resolves test to become a DOM object.

Alert (test) After the script test function, or a function.

Looking at the SVN version found that I was doing another function when I added the form form to wrap this radio up. Error causing browser parsing.

Summary: Not necessarily unchanged code is no problem, perhaps the change of place caused by other problems. Some browser compatibility problems are caused by code is not standardized, later write code to be standardized!

Daniel, if you know why you added the form browser to parse the problem, tell me. Appreciate!

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.