急求:在asp中点击按钮怎么才能让数据库中的东西显示在本页面中
下边的好比是一个表格:——————————————————————————问题:你叫什么名字?———————————————————————————答案:“按钮”()——...
下边的好比是一个表格:
——————————————————————————
问题: 你叫什么名字?
———————————————————————————
答案:“按钮”( )
———— ——————————————————————
点击按狃怎么才能让答案显示在括号中,问题也是从数据库中掉出来的,答案也要从数据库中显示在本页面,
ASP怎么样才能实现啊,请高手帮忙,谢谢了!下边的是我的代码,
<!--#include file="conn.asp" -->
<!--#include file="sub.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>index</title>
</head>
<% set rss=server.CreateObject("adodb.recordset")
sql="select * from content order by id asc"
rss.open sql,conn,1,1 %>
<body>
<p>
<% do while not rss.eof %>
<table width="500" border="1" align="center">
<tr>
<td colspan="2"><%=rss("question")%></td>
</tr>
<tr>
<td><form name="form1" method="post" action="">
<input type="button" name="button" value="查看答案;" onclick="">
</form>
</td>
<td ></td>
</tr>
</table>
<%
rss.movenext
loop
rss.close
set rss=nothing
%>
</p>
</body>
</html> 展开
——————————————————————————
问题: 你叫什么名字?
———————————————————————————
答案:“按钮”( )
———— ——————————————————————
点击按狃怎么才能让答案显示在括号中,问题也是从数据库中掉出来的,答案也要从数据库中显示在本页面,
ASP怎么样才能实现啊,请高手帮忙,谢谢了!下边的是我的代码,
<!--#include file="conn.asp" -->
<!--#include file="sub.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>index</title>
</head>
<% set rss=server.CreateObject("adodb.recordset")
sql="select * from content order by id asc"
rss.open sql,conn,1,1 %>
<body>
<p>
<% do while not rss.eof %>
<table width="500" border="1" align="center">
<tr>
<td colspan="2"><%=rss("question")%></td>
</tr>
<tr>
<td><form name="form1" method="post" action="">
<input type="button" name="button" value="查看答案;" onclick="">
</form>
</td>
<td ></td>
</tr>
</table>
<%
rss.movenext
loop
rss.close
set rss=nothing
%>
</p>
</body>
</html> 展开
2个回答
展开全部
将"答案字段名"替换为相应内容就OK了
<!--#include file="conn.asp" -->
<!--#include file="sub.asp" -->
<% set rss=server.CreateObject("adodb.recordset")
sql="select * from content order by id asc"
rss.open sql,conn,1,1
num_count=0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>index</title>
</head>
<body>
<script language="javascript">
function check_input(re_where,what)
{re_where.innerHTML=what
}
user_basic.rows[0].cells[4]
</script>
<table width="58%" border="0" cellspacing="0" cellpadding="0" id="aq">
<% do while not rss.eof %>
<tr>
<td width="52%"><%=rss("question")%> </td>
<td width="15%">
<input type="button" name="Submit" value="查看答案" onclick="check_input(aq.rows[<%=num_count%>].cells[2],'<%=rss("答案字段名")%>')" />
</td>
<td width="33%"> </td>
</tr>
<%
rss.movenext
num_count=num_count+1
loop
rss.close
set rss=nothing
%>
</table>
</body>
</html>
<!--#include file="conn.asp" -->
<!--#include file="sub.asp" -->
<% set rss=server.CreateObject("adodb.recordset")
sql="select * from content order by id asc"
rss.open sql,conn,1,1
num_count=0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>index</title>
</head>
<body>
<script language="javascript">
function check_input(re_where,what)
{re_where.innerHTML=what
}
user_basic.rows[0].cells[4]
</script>
<table width="58%" border="0" cellspacing="0" cellpadding="0" id="aq">
<% do while not rss.eof %>
<tr>
<td width="52%"><%=rss("question")%> </td>
<td width="15%">
<input type="button" name="Submit" value="查看答案" onclick="check_input(aq.rows[<%=num_count%>].cells[2],'<%=rss("答案字段名")%>')" />
</td>
<td width="33%"> </td>
</tr>
<%
rss.movenext
num_count=num_count+1
loop
rss.close
set rss=nothing
%>
</table>
</body>
</html>
展开全部
......
<table width="500" border="1" align="center">
<tr>
<td colspan="2"><%=rss("question")%></td>
</tr>
<tr>
<td><form name="form1" method="post" action="">
<input type="button" name="button" value="查看答案;" onclick="a1.style.display=''">
</form>
</td>
<td><div id="a1" style="display:none"><%=rss("answer")%></div></td>
</tr>
</table>
......
rss("answer")是答案
<table width="500" border="1" align="center">
<tr>
<td colspan="2"><%=rss("question")%></td>
</tr>
<tr>
<td><form name="form1" method="post" action="">
<input type="button" name="button" value="查看答案;" onclick="a1.style.display=''">
</form>
</td>
<td><div id="a1" style="display:none"><%=rss("answer")%></div></td>
</tr>
</table>
......
rss("answer")是答案
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询