js错误: email() is not a function
2012-10-28 18:03
387 查看
js脚本拿出来和<input/>测试是正确的: <script src="../js/jquery-1.4.3.js"></script> <script> function email(){ alert("===="); } </script>
但火狐的错误控制台却报异常:
email() is not a function
明明是一个函数,但火狐控制台真J。。
由于JSP文件是别人写好直接使用的,所以,来回测试,折腾!最后,没办法,一段一段代码删除测试,才发现。有form和没form的情况下有区别!
一、将<input name="email" type="text" id="txtEmail" class="text_input" onblur="emailFunc()"/>
定义在Form标签里,则有异常,没输出"===="
二、去掉form标签,无异常,有输出"===="
可是为什么呢? input标签是必须要在form标签里定义使用的,折腾,继续折腾,有网也不百度,折腾了1个多小时,只好百度看看有没有方法。
找到了一个方法:
http://hi.baidu.com/shuaixiaoxin/item/df3d15383d4c8a8ef5e4ad97
内容是:
.在表单中元素的name和id属性中有设置为和此元素调用js方法的方法名相同时,也会报这种js错误
让js中的function名和表单form中的input的name值不同否则容易出错
也就是在有form和没有form会出现js错误
看一回,没看明白,再看,原来是指:
在form标签里,若<input>标签定义的事件js函数名称-email() 和 name / id对应的属性值一致时,会报这种js错误
解决:
将js的函数名称email()变更为:emailFunc()
相关文章推荐
- JS监听事件错误:Uncaught TypeError: xx(函数名)is not a function at HTMLInputElement.onclick
- JS-”Undefined is not a function“错误
- js错误:Uncaught TypeError: accept is not a function at HTMLInputElement.onclick
- js错误"submit is not a function"的解决方法
- Angularjs + Webpack 框架里,引入Bootstrap-datepicker插件时,datepicker is not a function错误的解决方法
- 解决Zepto.js不支持animate报错的问题,错误信息$(...).animate is not a function
- Node.js 连接Mongodb错误:db.listCollections is not a function
- node.js连接MongoDB数据成功之后,抛出错误,db.collection is not a function
- js提交表单错误:document.form.submit() is not a function
- js提交表单错误:document.form.submit() is not a function
- JS中出现“$(...).dropdown is not a function”错误的解决
- js提交表单错误:form.submit is not a function
- js提交表单错误:document.form.submit() is not a function
- jquery TypeError: 'undefined' is not a function (evaluating 'elem.nodeName.toLowerCase()') [jquery.js:1904]错误原因
- js提交表单错误:document.form.submit() is not a function
- 一个不容易觉察到的js错误,function () {}(function () {}) is not a functio
- node.js开发错误——TypeError: req.flash is not a function
- js错误Uncaught TypeError: $(...).datagrid is not a function自己写的并没有错但是一直报这个错(详解)
- Vue.js搭建路由报错 router.map is not a function
- js报错:email() is not a function