问,我下面的一段ASP程序,返回值的时候如何将返回值加入表格(提示就有分)

rjjjhsjy 2005-11-22 09:28:27
将返回的窗口内容加在表格里面(规则的)
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>1</title>
</head>

<body>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var ans = new Array;
var done = new Array;
var yourAns = new Array;


var score = 0;
ans[1] = "对";
ans[2] = "错";
ans[3] = "对";
ans[4] = "错";
ans[5] = "对";
ans[6] = "错";



function Engine(question, answer) {
yourAns[question]=answer;
}

function Score(){
var SecWin =
window.open("","scorewin","scrollbars,width=190,height=320")
var answerText = "看看你的成绩如何?\n";
for(i=1;i<=6;i++){
answerText=answerText+"\n-\n问题:"+i+"";
if(ans[i]!=yourAns[i]){
answerText=answerText+"\n答案:"+ans[i]+"";
}
else{
answerText=answerText+"对的";
score++;
}
}

answerText=answerText+"\n\n你的成绩是:"+score+"\n";

//now score the user
answerText=answerText+"\n结论 : ";
if(score<=0){
answerText=answerText+"你应该好好多学点了!";
}
if(score>=1 && score <=2){
answerText=answerText+"你还是有些知识欠缺的!";
}
if(score>=3 && score <=3){
answerText=answerText+"做的还不错,但还需要努力!";
}
if(score>4){
answerText=answerText+"哇,你可真是厉害,高手,高手!!";
}

SecWin.document.write(answerText);

}
// End -->
</script>
<b>Test your knowledge of Java!</b>
<hr>
<FORM>
<b>1. What is the name of the Java mascot?</b><br>
<input type=radio name="q1" value="对" onClick="Engine(1, this.value)"> 对<br>
<input type=radio name="q1" value="错" onClick="Engine(1, this.value)"> 错<br>
<b>2. Where is the best place to get Java software?</b><br>
<input type=radio name="q2" value="对" onClick="Engine(2, this.value)">对<br>
<input type=radio name="q2" value="错" onClick="Engine(2, this.value)">错<br>
<b>3. A 'for' loop in Java looks like this....</b><br>
<input type=radio name="q3" value="对" onClick="Engine(3, this.value)">对<br>
<input type=radio name="q3" value="错" onClick="Engine(3, this.value)">错<br>
<b>4. Which platform can not run Java.</b><br>
<input type=radio name="q4" value="对" onClick="Engine(4, this.value)">对<br>
<input type=radio name="q4" value="错" onClick="Engine(4, this.value)">错<br>
<b>5. 'JMF' stands for: </b><br>
<input type=radio name="q5" value="对" onClick="Engine(5, this.value)">对<br>
<input type=radio name="q5" value="错" onClick="Engine(5, this.value)">错<br>
<b>6. Which platform can not run Java.</b><br>
<input type=radio name="q6" value="对" onClick="Engine(6, this.value)">对<br>
<input type=radio name="q6" value="错" onClick="Engine(6, this.value)">错<br>
<CENTER>
<input type=button onClick="Score()" value="看看我的成绩?">
</CENTER>
</FORM>
<p> </p>
</body>

</html>
...全文
69 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hqlrj 2006-07-07
  • 打赏
  • 举报
回复
rs.open sqltext,conn,1,1
改为
rs.open sqltext,conn,1,1
If Not Rs.Eof Then
Response.Write "已经存在,请修改Title后重试<p><a href=""javascript:history.back();"">立即返回修改</a>"
Response.End
End If
jspadmin 2005-11-22
  • 打赏
  • 举报
回复
控制字符串,来控制表格,字符串输出,asp的话,response.write str ,vbs:document.write str
-----------------------------------------------------------------------------
欢迎光临我的小站http://www.pifoo.com 有什么问题可以给我留言http://www.pifoo.com/guestbook/ 我的QQ:33323489
huguang 2005-11-22
  • 打赏
  • 举报
回复
简单改了一下你的部分代码,参考一下!

function Score(){
var SecWin =
window.open("","scorewin","scrollbars,width=190,height=320")
var answerText = "看看你的成绩如何?<table border='1'>";
for(i=1;i<=6;i++){
answerText=answerText+"<tr><td>问题:</td><td>"+i+"</td>";
if(ans[i]!=yourAns[i]){
answerText=answerText+"<td>答案:"+ans[i]+"</td></tr>";
}
else{
answerText=answerText+"<td>对的</td></tr>";
score++;
}
}

answerText=answerText+"</table>你的成绩是:"+score+"\n";
huguang 2005-11-22
  • 打赏
  • 举报
回复
首先,你这只是一个javascript问题,发错地方了!

最后输出的就是answerText这个字符串,而且注意程序之前一直在处理这个字符串!

那么想要把结果放入表格,直接在处理answerText过程中,加入html表格代码就行了

例如加入html的换行
answerText = "看看你的成绩如何?\n<br><br>"

28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧