QuestionData1.htm:
-------------------------------------------------------------<tr><td>题目:1+1=?</td></tr>
<tr><td>
<input type=radio name=Question1Answer >1<br>
<input type=radio name=Question1Answer isRight="true">2<br>
<input type=radio name=Question1Answer >3<br>
<input type=radio name=Question1Answer >4<br>
</td></tr><tr><td>题目:1+2=?</td></tr>
<tr><td>
<input type=radio name=Question2Answer >1<br>
<input type=radio name=Question2Answer >2<br>
<input type=radio name=Question2Answer isRight="true">3<br>
<input type=radio name=Question2Answer >4<br>
</td></tr>-----------------------------------------------------------------------
-----------------------------------------------------------------------TestPaper.htm:
----------------------------------------
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>支持民族工业,尽量少买日货</title>
</head>
<IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
<body>
<BR>
<input type=button value="看看成绩" onclick="getScore()">
<table>
<script language=javascript>
oDownload.startDownload('QuestionData1.htm',document.write);
</script>
</table>
</body></html>
<script>
function getScore()
{
var theInputs=document.getElementsByTagName("INPUT");
var questionNum=0;
var rightNum=0;
for (var i=0;i<theInputs.length;i++){
if(theInputs[i].isRight)
{
questionNum++;
if(theInputs[i].checked) rightNum++;
}
}
alert("您答对了"+questionNum+"道题中的"+rightNum+"道");
}</script>

解决方案 »

  1.   

    但如果需要先显示第一题,点击下一题再显示第二题.而且不能直接载入一个htm页面,就如我上面所说的,那该怎么办?用XML应如何写?谢谢!
      

  2.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>支持民族工业,尽量少买日货</title>
    </head>
    <IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
    <body>
    <BR>
    <input type=button value="得到题目" onclick="oDownload.startDownload('QuestionData1.htm',changeQuestion);">
    <div id=aaa></div></body></html>
    <script>function changeQuestion(QuestionStr)
    {
    aaa.innerHTML=QuestionStr;
    }
    </script>
      

  3.   

    多谢JK!可能我还没表达清楚我的意思。目的是需要从一个包含所有题目的文件(如Questions.ptf)中调出一个题目显示在HTML页面,点击下一题再调出下一个题目,而前一题则在不显示。就象调用数据库一样。那该怎么办?