得到答案
function GetAnswer()
{
var a = document.forms[0].elements; // 得到form中的所有元素
var count = a.length; // form中元素的个数
var answer = ""; // 用于保存答案
var str = ""; // 临时变量
var chk1 = "",chk2 = "";
for (var i=0;i<count;i++)
{
if (a[i].type && a[i].type=="radio") // 对radio作判断
{
if (a[i].checked == true)
{
answer += a[i].name.substring(2,a[i].name.length) + "_" + a[i].value + ",";
}
}
if (a[i].type && a[i].type=="checkbox") // 对checkbox作判断
{
if (a[i].checked == true)
{
str += a[i].value;
}
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Titles where type = 'business'", MyConnection)
DS = New DataSet()
MyCommand.Fill(DS, "书名")
MyDataList.DataSource = DS.Tables("书名").DefaultView
MyDataList.DataBind()
End If
End Sub
Sub Submit_Click(Src As Object, E As EventArgs)
Dim I As Long
For I=0 To MyDataList.Items.Count -1
Dim CurrentCheckBox As CheckBox
CurrentCheckBox = MyDataList.Items(I).FindControl("save")
Message.InnerHtml &= "项 (" & i & "): " & CurrentCheckBox.Checked.ToString() & "<br>"
Next
End Sub