<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<SCRIPT LANGUAGE="JavaScript">
<!--
var points=0;
function fncSubmit(){
if (document.form1.text1.value=="1"){
points=points+2;
}
if (document.form1.text2.value=="2"){
points=points+3;
}
alert(points);
window.location.reload();
}
//-->
</SCRIPT>
</head><body>
<form name="form1" id="form1">
共5分:
<br>
<input type="text" name="text1" value="">2分
<input type="text" name="text2" value="" >3分
<input type="button" name="btn1" value="提交" onclick="fncSubmit()">
<input type="button" name="btn2" value="正确答案" onclick="alert('1,2')"></form>
</body>
</html>
//是这个样子吗?

解决方案 »

  1.   

    原来是要代码啊?Flash可以啊
      

  2.   

    只要求填空的用JavaScript写的代码,各位高手来几个撒
      

  3.   

    看看行不行,如果不行,自己改改吧。<html>
    <head>
    <title>在线答题--塞北的雪</title>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
        var tlist="t1_1,t1_2,t2_1"
        var tk=new Array()  //题库
        //第一道题
        tk["t1_1"]=new Array();
        tk["t1_1"]["code"]="1"
        tk["t1_1"]["result"]="北京"
        tk["t1_1"]["score"]=5
        
        tk["t1_2"]=new Array();
        tk["t1_2"]["code"]="2"
        tk["t1_2"]["result"]="东京"
        tk["t1_2"]["score"]=8
        
         //第二道题
        tk["t2_1"]=new Array();
        tk["t2_1"]["code"]="3"
        tk["t2_1"]["result"]="周笔畅"
        tk["t2_1"]["score"]=7 var points=0;
    //判卷
    function fncSubmit(){
        points=0;
        var arrT=tlist.split(',');
        for(var i=0;i<arrT.length;i++)
        {
          var tInput=eval("document.form1." + arrT[i]);
          if(!tInput) continue;
          var tInputValue=tInput.value;
          if(tInputValue==tk[arrT[i]]["result"])
              points+=tk[arrT[i]]["score"]
        }
    document.getElementById("oScore").innerText="得分:" + points.toString();
    }

    //显示正确答案
    function showResult(){
        var arrT=tlist.split(',');
        var resultList=new String();
        resultList="";
        for(var i=0;i<arrT.length;i++)
        {
          var tInput=eval("document.form1." + arrT[i]);
          if(!tInput) continue;
          var tInputValue=tInput.value;
          resultList = resultList + tk[arrT[i]]["code"].toString() + ":" + tk[arrT[i]]["result"] + "(" + tk[arrT[i]]["score"] + "分)" +  "&nbsp;&nbsp;&nbsp;";
        }
    document.getElementById("oResult").innerHTML="标准答案:" + resultList.toString();
    }
    //-->
    </SCRIPT>
    <style>
    .line_r { font-size: 12px; color: #000000; background:; border: none; border-bottom:solid 1px #000000; text-align:left;}
    </style>
    </head><body>
    <form name="form1" id="form1">
    在线答题:
    <br><br>
    1、中国的首都是<input class="line_r" type="text" name="t1_1" value="">,日本的首都是<input class="line_r" type="text" name="t1_2" value=""><br>
    2、2005孟牛酸酸乳超级女生的亚军是<input class="line_r" type="text" name="t2_1" value="" ><br><br>
    <input type="button" name="btn1" value="提交" onclick="fncSubmit()">
    <input type="button" name="btn2" value="正确答案" onclick="showResult();">
    <br>
    <span id="oScore"></span>
    <br>
    <span id="oResult"></span>
    </form>
    </body>
    </html>