前台代码如下:<%@ Control Language="vb" AutoEventWireup="false" Codebehind="ChangTextBox.ascx.vb" Inherits="TestRadioButtonListControl.ChangTextBox" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %><asp:radiobuttonlist id="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="Yes">Yes</asp:ListItem>
<asp:ListItem Value="No">No</asp:ListItem>
</asp:radiobuttonlist><script language="javascript" type="text/javascript">
function ChangeLableColor()
{
debugger;
alert("run 0");
}我在后台的PageLoad方法里
Me.RadioButtonList1.Attributes.Add("OnSelectedIndexChanged", String.Format("javascript:ChangeLableColor()"))"OnSelectedIndexChanged"是RadioButtonList的一个事件名称。ChangeLableColor 是我javaScript的函数名称。
经过调试后,我发现ChangeLableColor 函数根本没有调用,
请问我的代码问题出在哪里?如何在服务器端调用javaScript的代码?
<asp:ListItem Value="Yes">Yes</asp:ListItem>
<asp:ListItem Value="No">No</asp:ListItem>
</asp:radiobuttonlist><script language="javascript" type="text/javascript">
function ChangeLableColor()
{
debugger;
alert("run 0");
}我在后台的PageLoad方法里
Me.RadioButtonList1.Attributes.Add("OnSelectedIndexChanged", String.Format("javascript:ChangeLableColor()"))"OnSelectedIndexChanged"是RadioButtonList的一个事件名称。ChangeLableColor 是我javaScript的函数名称。
经过调试后,我发现ChangeLableColor 函数根本没有调用,
请问我的代码问题出在哪里?如何在服务器端调用javaScript的代码?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货