无法在C#中添加onmousedown javascript事件来控制

时间:2015-08-21 12:53:22

标签: javascript c#

rbl_attend_mark是一个RadioButtonList,似乎包含ListItems

我可以成功设置“标题”(悬停)并将javascript函数附加到“onclick”事件处理程序,但是尝试将javacript附加到“onmousedown”函数不起作用;

foreach (ListItem li in rbl_attend_mark.Items)
{
    li.Attributes.Add("title", attend.Where(r => r.attend_id == int.Parse(item.Value)).First().attend_desc);
    li.Attributes.Add("onclick", "javascript:change_background_colour(this.value, this.id, !this.__chk)");
    li.Attributes.Add("onmousedown", "javascript:this.__chk = this.checked");
}

知道我做错了吗?

修改的 我应该解释一下,它根本不会渲染onmousedown函数;

<input id="rbl_attend_mark_4085_0" type="radio" value="1" name="rbl_attend_mark_4085" onclick="javascript:change_background_colour(this.value, this.id, !this.__chk);">

0 个答案:

没有答案