如何動態增加 RadioButtonList 的onClick事件

摘要:如何動態增加 RadioButtonList 的onClick事件

 問題:

我想動態增加 asp:RadioButtonList 的onClick事件去執行某個自訂的JavaScript函數

該如何寫

 

解答:

 

在page_load裡:

RadioButtonList1.Attributes.Add("onclick", "todo()");

在aspx裡:

 

        <script>

            function todo() {

                alert("test");

            }

        </script>

來源:

http://social.msdn.microsoft.com/Forums/zh-TW/236/thread/bebbdfca-8dd3-4f0e-90eb-cd6b953f532a/#ac5ee3e1-33ca-4dc3-b517-d687b4cbeb08 


 

網頁設計 -->找網站銀行

好站推薦:網頁設計除臭襪