求助!!!为什么radio的onclick事件无效啊????

w785592116 2011-10-23 04:56:10
<head>
<script language="javascript">
function select(){
alert(123);
}
</script>
</head>
<body>
<form name="form1" id="table_1">
<table border="1" class="table" align="center">
<tr align="center">
<td>名字</td><td>首选</td><td>备选</td>
</tr>
<tr align="center">
<td>1</td><td><input type="radio" name="check1" id="11" onClick="select();" value="大厦" ></td> <td><input type="radio" name="check2" id="17" onclick="select();" value="大厦"></td>
</tr>
</table>
</form>
</body>
...全文
1512 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
w785592116 2011-10-26
  • 打赏
  • 举报
回复
郁闷啊 找了N天就这错误。。。
hardy8818 2011-10-24
  • 打赏
  • 举报
回复
同上 楼主用到了html的关键词了
jayrao5566 2011-10-24
  • 打赏
  • 举报
回复
 select 是个标签
小笨熊 2011-10-24
  • 打赏
  • 举报
回复
onClick="select();" 关键字的问题,以后避免用关键字命名。。。
leehuat 2011-10-24
  • 打赏
  • 举报
回复

select 是html的关键字
gmemai 2011-10-24
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 renyiqiu 的回复:]

别用关键字进行命名,会引发不必要的错误
[/Quote]
学习
renyiqiu 2011-10-23
  • 打赏
  • 举报
回复
别用关键字进行命名,会引发不必要的错误
hookee 2011-10-23
  • 打赏
  • 举报
回复
换个函数名select1 即可。


<head>
<script language="javascript">
function select1(){
alert(123);
}
</script>
</head>
<body>
<form name="form1" id="table_1">
<table border="1" class="table" align="center">
<tr align="center">
<td>名字</td><td>首选</td><td>备选</td>
</tr>
<tr align="center">
<td>1</td><td><input type="radio" name="check1" id="11" onClick="select1();" value="大厦" ></td> <td><input type="radio" name="check2" id="17" onclick="select1();" value="大厦"></td>
</tr>
</table>
</form>
</body>
豆虫 2011-10-23
  • 打赏
  • 举报
回复
另外:咱是不是该考虑结贴了 否则以后别人是不会再给你回帖了
结贴是一种美德。
豆虫 2011-10-23
  • 打赏
  • 举报
回复
onClick="select();"
楼主的这个函数名select有问题 和其dom中的函数名重复了 换个别的名字就可以了
所以我么尽量不要用这种有歧义的名字做函数名

87,914

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧