社区
JavaScript
帖子详情
Uncaught TypeError: string is not a function 是怎么一回事啊
wuzuyu365
2014-01-26 02:57:33
<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-search" onclick="search()">查询</a>
点击查询按钮时报错:
Uncaught TypeError: string is not a function
把search()函数改个其他名字就没问题,但这到底是怎么回事,有哪位大神知道的?
...全文
4925
5
打赏
收藏
Uncaught TypeError: string is not a function 是怎么一回事啊
查询 点击查询按钮时报错: Uncaught TypeError: string is not a function 把search()函数改个其他名字就没问题,但这到底是怎么回事,有哪位大神知道的?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
汉尼拔
2014-01-27
打赏
举报
回复
Mark search(ie,ff,chrome), download(chrome)
似梦飞花
2014-01-26
打赏
举报
回复
<html>
<head>
<script type="text/javascript">
function search(){
alert('a');
}
window.onload=function(){
var a=document.getElementById('a');
if(a.addEventListener){
a.addEventListener('click',search,false);
}else{
a.attachEvent('onclick',search);
}
}
</script>
</head>
<body>
<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-search" id='a'>查询</a>
</body>
</html>
或者这样试试
zhjdg
2014-01-26
打赏
举报
回复
元素有 search 的属性。 http://stackoverflow.com/questions/7852237/cant-use-download-as-a-function-name-in-javascript
似梦飞花
2014-01-26
打赏
举报
回复
关键字吧?函数名不是能随便取的 要避开一些关键的函数名啊 关键字啊的
android 通过webview 取源码
Unc
aught
TypeError
: undefined is not a
f
unc
tion
在4.4以后如果还用网上流传的取源码方法就会出现这错误。本列做到高低版本都能取。
Unc
aught
TypeError
:
string
is not a
f
unc
tion
chrome 浏览器中 定义download 方法,一直报 "
Unc
aught
TypeError
:
string
is not a
f
unc
tion
" 错误,后来将方法名修改后没事了。不知道什么原因,chrome的专权吧。
“
Unc
aught
TypeError
:
string
is not a
f
unc
tion
”
今天在js中写了一个方法叫做search(),然后点击按钮的时候提示: “
Unc
aught
TypeError
:
string
is not a
f
unc
tion
” 百思不得其解啊,我的js木有问题啊啊.... 后来才发现酱紫滴...... search() 方法用于检索字符串中指定的子字符串,或检索与正则表达式相匹配的子字符串。 语法
string
Object.search(re...
javascript 错误 "
Unc
aught
TypeError
:
string
is not a
f
unc
tion
"
在chrome环境下用javascript,有个函数名是search(),一直报错,
Unc
aught
TypeError
:
string
is not a
f
unc
tion
,且不运行。后来改了函数名就好了!
Unc
aught
TypeError
: XXX is not a
f
unc
tion
解决
Unc
aught
TypeError
: arr[4] is not a
f
unc
tion
在点击按钮弹出对应索引练习中出现的问题 出现此问题的原因是:for循环中i<10和i++的位置写反了,颠倒过来就不报错了,正确书写如下 var arr = []; for (let i = 0;i < 10; i++ ) { arr[i] =
f
unc
tion
() { console.log(i) } } arr[4]();
JavaScript
87,997
社区成员
224,708
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章