|
Sorry, I came home late after get off work. The test passed:
Front desk:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled page</title>
<script language="javascript">
<!--
var a = new Array();
The
function myClick(e)
{
for(var h=0;h<document.all.length;h++)
{
if(document.all(h).tagName == "INPUT"&&document.all(h).type == "radio")
{
if(document.all(h).id == e.id)
{
if(a[h] == 1)
e.checked = false;
else
e.checked = true;
}
}
}
for(var i=0;i<document.all.length;i++)
{
if(document.all(i).tagName == "INPUT"&&document.all(i).type == "radio")
{
if(document.all(i).id == e.id)
{
a[i] = 1;
}
else
{
a[i] = 0;
}
}
}
}
//-->
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem>a</asp:ListItem>
<asp:ListItem>b</asp:ListItem>
</asp:RadioButtonList>
</div>
</form>
</body>
</html>
Backstage:
//...
protected void Page_Load(object sender, EventArgs e)
{
for(int i = 0; i <this.RadioButtonList1.Items.Count; i++)
{
this.RadioButtonList1.Items[i].Attributes.Add("onclick", "myClick(this);");
}
} |
|