简单教程
提交运行
代码编辑器:
<script runat="server"> Sub submit(Source As Object, e As EventArgs) if r1.Checked=True then p1.InnerHtml="Your favorite color is red" else if r2.Checked=True then p1.InnerHtml="Your favorite color is green" else if r3.Checked=True then p1.InnerHtml="Your favorite color is blue" end if end if end if End Sub </script> <!DOCTYPE html> <meta charset="utf-8" /> <form runat="server"> <p>Select your favorite color: <br> <input id="r1" name="col" type="radio" runat="server">Red</input> <br> <input id="r2" name="col" type="radio" runat="server">Green</input> <br> <input id="r3" name="col" type="radio" runat="server">Blue</input> <br> <input type="button" value="Submit" OnServerClick="submit" runat="server"/> <p id="p1" runat="server" /> </form>
运行结果: