数据库绑定做好了 这是我的一个新ASP代码 现在我想当点一个单选按钮时候(有很多个单选按钮组),就把它的值传递到一个div中,要一行行的显示出来,并且有个提交按钮来提交内容。
真心感谢
<%@ Language=VBScript %>
<%
if session("pass")<> 1 then
response.redirect "login.asp"
else
end if
set rs=server.createobject("adodb.recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("exercise.mdb")'初始化数据库
sql="select * from test"
rs.open sql,conn,3,3
do while not rs.eof
RANDOMIZE
RandomValue = INT(17*RND)+1
rs("count")=rs("count")+RandomValue
rs.update
rs.movenext
loop
rs.closesql="select top 5 * from test order by count desc"
Set rs = conn.Execute(sql)
%><head>
<style type="text/css">
<!--
.unnamed1 { font-size: 10pt; text-decoration: none}
-->
</style>
<script>
function GetValue()
{
var Key = GetRadioValue("ans<%=i%>");
var str = Key+"<br/>"
if(document.getElementById("N1").checked)
{
str = str + CheckV
}
document.getElementById("Content").innerHTML = str;
}function GetRadioValue(RadioName){
var obj;
obj=document.getElementsByName(RadioName);
if(obj!=null){
var i;
for(i=0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
}
return null;
}
</script>
<FORM action="mailto:[email protected]?subject=锐明视讯" id=FORM1 method=post name=FORM1 enctype="text/plain">
<div id="Content" style="border:1px solid #000000;height:100px; width:100px;"></div>
<P align="center">
<%
i=1
rs.movefirst
do while not rs.eof%>
<P align="center"> <%=rs("question")%> </P>
<div align="center">
<TABLE align=center border=1 cellPadding=1 cellSpacing=1 width="35%" bordercolor="#0099FF">
<TR bgcolor="#99CCFF">
<TD style="WIDTH: 70%" width="49%">
<INPUT name=ans<%=i%> type=radio value="A">
<%=rs("A")%> </TD>
</TR>
<TR bgcolor="#CCCCFF">
<TD width="49%">
<input name=ans<%=i%>
type=radio value="B">
<%=rs("B")%> </TD>
</TR>
<TR bgcolor="#99CCFF">
<td width="51%">
<input name=ans<%=i%>
type=radio value="C">
<%=rs("C")%> </td>
</TR>
<TR bgcolor="#CCCCFF">
<TD width="49%">
<input name=ans<%=i%>
type=radio value="D" >
<%=rs("D")%> </TD>
</TR>
</TABLE>
<%
i=i+1
rs.movenext
loop
%>
</div>
<div align="center">
</P>
</div>
<P align="center"> </P>
<P align=center>
<INPUT id=submit1 name=submit1 type=submit value="提交">
<INPUT id=reset1 name=reset1 type=reset value="重填">
</P>
</FORM>
真心感谢
<%@ Language=VBScript %>
<%
if session("pass")<> 1 then
response.redirect "login.asp"
else
end if
set rs=server.createobject("adodb.recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("exercise.mdb")'初始化数据库
sql="select * from test"
rs.open sql,conn,3,3
do while not rs.eof
RANDOMIZE
RandomValue = INT(17*RND)+1
rs("count")=rs("count")+RandomValue
rs.update
rs.movenext
loop
rs.closesql="select top 5 * from test order by count desc"
Set rs = conn.Execute(sql)
%><head>
<style type="text/css">
<!--
.unnamed1 { font-size: 10pt; text-decoration: none}
-->
</style>
<script>
function GetValue()
{
var Key = GetRadioValue("ans<%=i%>");
var str = Key+"<br/>"
if(document.getElementById("N1").checked)
{
str = str + CheckV
}
document.getElementById("Content").innerHTML = str;
}function GetRadioValue(RadioName){
var obj;
obj=document.getElementsByName(RadioName);
if(obj!=null){
var i;
for(i=0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
}
return null;
}
</script>
<FORM action="mailto:[email protected]?subject=锐明视讯" id=FORM1 method=post name=FORM1 enctype="text/plain">
<div id="Content" style="border:1px solid #000000;height:100px; width:100px;"></div>
<P align="center">
<%
i=1
rs.movefirst
do while not rs.eof%>
<P align="center"> <%=rs("question")%> </P>
<div align="center">
<TABLE align=center border=1 cellPadding=1 cellSpacing=1 width="35%" bordercolor="#0099FF">
<TR bgcolor="#99CCFF">
<TD style="WIDTH: 70%" width="49%">
<INPUT name=ans<%=i%> type=radio value="A">
<%=rs("A")%> </TD>
</TR>
<TR bgcolor="#CCCCFF">
<TD width="49%">
<input name=ans<%=i%>
type=radio value="B">
<%=rs("B")%> </TD>
</TR>
<TR bgcolor="#99CCFF">
<td width="51%">
<input name=ans<%=i%>
type=radio value="C">
<%=rs("C")%> </td>
</TR>
<TR bgcolor="#CCCCFF">
<TD width="49%">
<input name=ans<%=i%>
type=radio value="D" >
<%=rs("D")%> </TD>
</TR>
</TABLE>
<%
i=i+1
rs.movenext
loop
%>
</div>
<div align="center">
</P>
</div>
<P align="center"> </P>
<P align=center>
<INPUT id=submit1 name=submit1 type=submit value="提交">
<INPUT id=reset1 name=reset1 type=reset value="重填">
</P>
</FORM>
解决方案 »
- Js 调用 WebService问题...
- 如何模拟csdn论坛的登陆,在登陆成功后显示用户名登信息
- 100分求解!
- 急死人了~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 文革简单问题:asp.net下如何将类编译为dll
- frameset有什么不好?
- 刚刚作完文章采集,丢到自己得空间里却不能用。散分郁闷一下。
- 我有一个文本文件,里面是一些有规则的数据,用什么方法可以将文件文件的内容,变成数据库里面一行一行的纪录?
- datagrid的排序及分页问题
- 怎样在页面过度期间显示Loading提示?
- gridview 分页后,不能纵向合并单元格?
- 高分求一个Microsoft Visual Studio 2008 Ajax控件的详细教程
type=radio value="<%=rs("C")%>" onclick="javascript:Show(this);"><script>
function Show(obj)
{
document.getElementById("Content").innerHTML=obj.value;
}
</script>
好像要循环???
现在我想当点一个单选按钮时候(有很多个单选按钮组),就把它的值传递到一个div中,要一行行的显示出来,并且有个提交按钮来提交内容。 你不是说只显示选中的一个值么??
type=radio value=" <%=rs("C")%>" onclick="javascript:Show(this);"> <script>
function Show(obj)
{
document.getElementById("Content").innerHTML=document.getElementById("Content").innerHTML + "<br />" + obj.value;
}
</script>
这是我的数据库 每个按钮组有4个答案 只要一个答案 共五个 以后我还加题目的
question A B C D ans count
操作系统 操作系统1 操作系统2 操作系统3 操作系统4 A 3666
内存条 内存条1 内存条2 内存条3 内存条4 B 3637
硬盘 硬盘1 硬盘2 硬盘3 硬盘4 C 3748
X3DVR X3DVR1 X3DVR4 X3DVR6 X3DVR8 B 3897
X2DVR X2DVR1 X2DVR2 X2DVR4 X2DVR5 B 3273
X4DVR X6DVR1 X6DVR2 X6DVR3 X6DVR0 A 3380
加速 加速1 加速2 加速3 加速4 4 3494
type=radio value=" <%=rs("C")%>" onclick="javascript:Show(this,<%=i%>);"><script>
var hash=new Array();
function Show(obj,pos)
{
document.getElementById("Content").innerHTML="";
hash[pos]=obj.value;
for(var n in hash)
{
document.getElementById("Content").innerHTML+=hash[n]+"<br />";
} }
</script>