简单教程
提交运行
代码编辑器:
<script runat="server"> Sub submit(Source As Object, e As EventArgs) if red.Checked=True then p1.InnerHtml="You prefer red!" else p1.InnerHtml="You prefer blue!" end if red.checked=false blue.checked=false End Sub </script> <!DOCTYPE html> <meta charset="utf-8" /> <form runat="server"> What color do you prefer? <br> <input id="red" type="checkbox" runat="server" /> Red <br> <input id="blue" type="checkbox" runat="server" /> Blue <br> <input type="button" value="Submit" OnServerClick="submit" runat="server"/> <p id="p1" runat="server" /> </form>
运行结果: