如何在oncheckedchange事件中为复选框调用javascript函数 [英] how to call a javascript functionfor a checkbox at oncheckedchange event
本文介绍了如何在oncheckedchange事件中为复选框调用javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨.
我在以下行中收到错误:
< asp:CheckBox ID =" 已选中 =" false"
OnCheckedChanged =" javascript:AlterChildren();" runat =" / >
错误如下:
).
为什么会这样..请尽快帮助我
解决方案
MS IntelliSense可能不会显示它,但是由于您检查了每个单击,尝试使用"OnClick = AlterChildren()"代替OnCheckChanged. 我在测试函数内部使用了一个简单的"alert"命令测试了该解决方案,并且效果很好.
如果您的复选框除了调用客户端函数外什么也不做,为什么您是否要通过服务器端事件来做到这一点?
使用类似
< INPUT TYPE ="checkbox" ID ="chkAnmelder" VALUE ="1" CHECKED ="false" onClick =">  ;
功能相同,开销较少
其客户希望将所有html控件转换为asp控件. /blockquote>
Hi..
I am getting the error in following line:
<asp:CheckBox ID="chkAnmelder" Checked="false" OnCheckedChanged="javascript:AlterChildren();" runat="server" />The error is following:
) expected.Why is this so.. please help me as soon as possible
解决方案MS IntelliSense might not show it, but since your checking on every click, try the "OnClick=AlterChildren()" instead of OnCheckChanged. I tested this solution with a simple "alert" command inside of a test function, and it worked fine.
If your checkbox does nothing but call a client-side function, why are you trying to do it with a server-side event?
use something like
<INPUT TYPE="checkbox" ID="chkAnmelder" VALUE="1" CHECKED="false" onClick="AlterChildren()">
Same functionality, less overhead
Its client''s desire to convert all the html controls into asp controls..
这篇关于如何在oncheckedchange事件中为复选框调用javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文