注册 登录
编程论坛 jQuery论坛

同一页面 分阶段提交表单

junxipang 发布于 2008-09-02 14:04, 2055 次点击
各位高人及斑竹大家好:我刚接触AJAX
现在我在做一个网络考试系统我是将考试题目从数据库中提取生成为XML文件
然后用XSLT文件将其转换为HTML文件展现给客户端,因为是考试系统所以在客户端
分了页想让学生在答题时点"下一页" 时将已经答完的题目保存到数
据库而学生则继续进入下一页答题 不知道如何实现,分页的数据就是下面的




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<html xmlns="http://www. >
<head><title>
    无标题页
</title></head>
<body>
    <form name="form11111" method="post" action="test.aspx" id="form11111">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTQ3NjcyMjIwMmRkGXCcfpUrEwSV8k3xY8DSlak+XDE=" />
</div>

    <div align="center">
        <html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:eMeng="http://211.70.128.1/">
  <script>
        
   function nextPage(num)
   {
    document.getElementById("content"+num).style.display="";
    num--;
    document.getElementById("content"+num).style.display="none";
    //alert(num);
   }
   function prevPage(num)
   {
    document.getElementById("content"+num).style.display="";
    num++;
    document.getElementById("content"+num).style.display="none";
   }
   function onInitialize()
   {
    var i = 1;
    document.getElementById("content"+i).style.display = "";
    var count=document.getElementById("param").value;//取得页面总层数
    //alert(count);
    for (i=2;i<=count;i++)
    {
     document.getElementById("content"+i).style.display = "none";
    }   
   }
   

   
   
  
 </script>
  <body onload="onInitialize()">
    <input type="hidden" id="param" value="6">
    <div id="content1" style="display:'none'" title="content1">
      <div id="danxuan">1...
              单选1<br>
              A.g<input type="radio" name="6">
              B.g<input type="radio" name="6">
              C.g<input type="radio" name="6">
              D.gg<input type="radio" name="6"></div>
      <div id="danxuan">2...
              单选2<br>
              A.fgfd<input type="radio" name="7">
              B.gdg<input type="radio" name="7">
              C.gddg<input type="radio" name="7">
              D.gdg<input type="radio" name="7"></div>
      <div id="danxuan">3...
              单选3<br>
              A.dgdg<input type="radio" name="9">
              B.fff<input type="radio" name="9">
              C.fff<input type="radio" name="9">
              D.fff<input type="radio" name="9"></div>
      <div id="danxuan">4...
              单选4<br>
              A.df<input type="radio" name="14">
              B.dff<input type="radio" name="14">
              C.df<input type="radio" name="14">
              D.fdf<input type="radio" name="14"></div>
      <div id="danxuan">5...
              单选5<br>
              A.f<input type="radio" name="15">
              B.ff<input type="radio" name="15">
              C.ff<input type="radio" name="15">
              D.f<input type="radio" name="15"></div>
      <div id="danxuan">6...
              单选6<br>
              A.f<input type="radio" name="17">
              B.ff<input type="radio" name="17">
              C.f<input type="radio" name="17">
              D.f<input type="radio" name="17"></div>
      <div id="navBar">
            第1页---
            <a href="#2" onclick="nextPage(2)">下一页</a>---
            共有6页---
          </div>
    </div>
    <input type="hidden" id="param" value="6">
    <div id="content2" style="display:'none'" title="content2">
      <div id="danxuan">7...
              单选7<br>
              A.s<input type="radio" name="18">
              B.s<input type="radio" name="18">
              C.ss<input type="radio" name="18">
              D.s<input type="radio" name="18"></div>
      <div id="danxuan">8...
              单选8<br>
              A.d<input type="radio" name="19">
              B.d<input type="radio" name="19">
              C.d<input type="radio" name="19">
              D.d<input type="radio" name="19"></div>
      <div id="danxuan">9...
              单选9<br>
              A.dfd<input type="radio" name="20">
              B.dfd<input type="radio" name="20">
              C.dfdf<input type="radio" name="20">
              D.<input type="radio" name="20"></div>
      <div id="danxuan">10...
              单选10<br>
              A.dfd<input type="radio" name="21">
              B.dfd<input type="radio" name="21">
              C.dfdf<input type="radio" name="21">
              D.<input type="radio" name="21"></div>
      <div id="duoxuan">11...
              多选1<br>
              A.ll<input type="checkbox" name="1">
              B.ll<input type="checkbox" name="1">
              C.l<input type="checkbox" name="1">
              D.l<input type="checkbox" name="1"></div>
      <div id="duoxuan">12...
              多选2<br>
              A.dd<input type="checkbox" name="4">
              B.dd<input type="checkbox" name="4">
              C.dd<input type="checkbox" name="4">
              D.dd<input type="checkbox" name="4"></div>
      <div id="navBar">
            第2页---
            <a href="#1" onclick="prevPage(1)">上一页</a>---
            <a href="#3" onclick="nextPage(3)">下一页</a>---
            共有6页---
          </div>
    </div>
    <input type="hidden" id="param" value="6">
    <div id="content3" style="display:'none'" title="content3">
      <div id="duoxuan">13...
              多选3<br>
              A.dfs<input type="checkbox" name="5">
              B.fdsfs<input type="checkbox" name="5">
              C.fsdfsdfsf<input type="checkbox" name="5">
              D.fs<input type="checkbox" name="5"></div>
      <div id="duoxuan">14...
              多选4<br>
              A.yy<input type="checkbox" name="6">
              B.yyy<input type="checkbox" name="6">
              C.yy<input type="checkbox" name="6">
              D.yy<input type="checkbox" name="6"></div>
      <div id="duoxuan">15...
              多选5<br>
              A.gg<input type="checkbox" name="7">
              B.ggg<input type="checkbox" name="7">
              C.gg<input type="checkbox" name="7">
              D.gg<input type="checkbox" name="7"></div>
      <div id="duoxuan">16...
              多选6<br>
              A.ff<input type="checkbox" name="8">
              B.ff<input type="checkbox" name="8">
              C.ff<input type="checkbox" name="8">
              D.f<input type="checkbox" name="8"></div>
      <div id="duoxuan">17...
              多选7<br>
              A.df<input type="checkbox" name="9">
              B.df<input type="checkbox" name="9">
              C.fdf<input type="checkbox" name="9">
              D.fdf<input type="checkbox" name="9"></div>
      <div id="duoxuan">18...
              多选8<br>
              A.df<input type="checkbox" name="10">
              B.dfdf<input type="checkbox" name="10">
              C.fsfsf<input type="checkbox" name="10">
              D.fsfsf<input type="checkbox" name="10"></div>
      <div id="navBar">
            第3页---
            <a href="#2" onclick="prevPage(2)">上一页</a>---
            <a href="#4" onclick="nextPage(4)">下一页</a>---
            共有6页---
          </div>
    </div>
    <input type="hidden" id="param" value="6">
    <div id="content4" style="display:'none'" title="content4">
      <div id="duoxuan">19...
              多选9<br>
              A.<input type="checkbox" name="11">
              B.<input type="checkbox" name="11">
              C.<input type="checkbox" name="11">
              D.<input type="checkbox" name="11"></div>
      <div id="duoxuan">20...
              多选10<br>
              A.null<input type="checkbox" name="12">
              B.<input type="checkbox" name="12">
              C.<input type="checkbox" name="12">
              D.<input type="checkbox" name="12"></div>
      <div id="panduan">21...
              判断1<br>
              A.false<input type="radio" name="1">
              B.1121<input type="radio" name="1"></div>
      <div id="panduan">22...
              判断2<br>
              A.true<input type="radio" name="2">
              B.1451<input type="radio" name="2"></div>
      <div id="panduan">23...
              判断3<br>
              A.true<input type="radio" name="3">
              B.12<input type="radio" name="3"></div>
      <div id="panduan">24...
              判断4<br>
              A.false<input type="radio" name="4">
              B.454<input type="radio" name="4"></div>
      <div id="navBar">
            第4页---
            <a href="#3" onclick="prevPage(3)">上一页</a>---
            <a href="#5" onclick="nextPage(5)">下一页</a>---
            共有6页---
          </div>
    </div>
    <input type="hidden" id="param" value="6">
    <div id="content5" style="display:'none'" title="content5">
      <div id="panduan">25...
              判断5<br>
              A.false<input type="radio" name="5">
              B.32<input type="radio" name="5"></div>
      <div id="panduan">26...
              判断6<br>
              A.false<input type="radio" name="6">
              B.96<input type="radio" name="6"></div>
      <div id="panduan">27...
              判断7<br>
              A.true<input type="radio" name="7">
              B.100<input type="radio" name="7"></div>
      <div id="panduan">28...
              判断8<br>
              A.false<input type="radio" name="8">
              B.22<input type="radio" name="8"></div>
      <div id="panduan">29...
              判断9<br>
              A.true<input type="radio" name="9">
              B.33<input type="radio" name="9"></div>
      <div id="panduan">30...
              判断10<br>
              A.false<input type="radio" name="10">
              B.21<input type="radio" name="10"></div>
      <div id="navBar">
            第5页---
            <a href="#4" onclick="prevPage(4)">上一页</a>---
            <a href="#6" onclick="nextPage(6)">下一页</a>---
            共有6页---
          </div>
    </div>
    <input type="hidden" id="param" value="6">
    <div id="content6" style="display:'none'" title="content6">
      <div id="tiankong">31....
              填空1<br>
              A.ttttuuuu<input type="checkbox" name="1">
              B.99<input type="checkbox" name="1"></div>
      <div id="tiankong">32....
              填空2<br>
              A.dfdf<input type="checkbox" name="4">
              B.22<input type="checkbox" name="4"></div>
      <div id="tiankong">33....
              填空3<br>
              A.dffdd<input type="checkbox" name="5">
              B.2345<input type="checkbox" name="5"></div>
      <div id="tiankong">34....
              填空4<br>
              A.dgd<input type="checkbox" name="6">
              B.67<input type="checkbox" name="6"></div>
      <div id="tiankong">35....
              填空5<br>
              A.<input type="checkbox" name="7">
              B.0<input type="checkbox" name="7"></div>
      <div id="navBar">
            第6页---
            <a href="#5" onclick="prevPage(5)">上一页</a>---
            共有6页---
          </div>
    </div>
  </body>
</html>&nbsp;&nbsp; &nbsp;&nbsp;
    </div>
    </form>
</body>
</html>
0 回复
1