a.html  b.html
a.html中有一个text 两个checkbox(高中、初中),和一个button 
当我在text输入姓名后并点中一个checkbox(大专)后,再点button,显示b.html页面 
并在b.html页面上显示:你的信息是
你的姓名:XX
你的学历:XXa.html 代码:<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>无标题页</title>
<script language="javascript" type="text/javascript">function tt()
{ var name =document.zl.textname.value;
  if(name.length==0)
  {
    alert("请输入姓名");
    document.zl.textname.focus();
  }
var str = ""; 
for(var i=0;i <=1;i++)

if(document.all("box")[i].checked)

str += document.all("box")[i].value + " ¦"; 


window.open("zuoye9_1.aspx?name="+name+"?str="+str.substring(0,str.length-1)); 

</script></head>
<body>
    <form name="zl" action="zuoye9_1.aspx">
   <div align="center">资料填写</div>
   <p align="center">姓名*
   <input type="text" name="textname" id="textname"  value="">
   </p>
   <p align="center">学历</p>
   <p align="center">
   <input type="checkbox" name="box" value="大专">大专 
   <input type="checkbox" name="box"  value="理学学士">理学学士 
   <input type="checkbox" name="box"  value="理学硕士">理学硕士</p>
   <p align="center">
   <input type="button" value="显示" onClick="tt();"> 
   </p>
   </form>
</body>
</html>b.html 的代码:<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script language="javascript">  
    var no = location.href;
    var n1 = no.length;//地址的总长度
    var n2 = no.indexOf("=");//取得=号的位置
    var na = no.substr(n2+1, n1);//从=号后面的内容
    var loc = location.href; 
    var str = loc.substring(loc.indexOf("=")+7);    document.write("你的详细资料");
    document.write("<br>")
    document.write("你的姓名是:"+na);
    document.write("<br>")
    document.write("你的学历是:"+str);
   
    </script>
</head>
<body>
</body>
</html>不知道应该怎么截取姓名,学历如果选第三个,不能显示。
那位高手看到帮忙看下,问题很菜,谢谢解答。

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【fanjun5】截止到2008-07-29 12:03:16的历史汇总数据(不包括此帖):
    发帖的总数量:2                        发帖的总分数:44                       每贴平均分数:22                       
    回帖的总数量:1                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:2                        结贴的总分数:44                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:100.00%                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    敬礼!
      

  2.   

    a.htm<html>
    <body>
    <input type="checkbox" name="hehe" value="初中">初中<br>
    <input type="checkbox" name="hehe" value="高中">高中<br>
    <input type="text" name="names" value=""><br>
    <input type="button" value="提交" onClick="tt();">
    </body>
    </html>
    <script>
    function tt(){
    window.open("b.htm","akdsfasdf","top=60,left=150,height=150,width=200,toolbar=no,menubar=no,location=no,status=yes");
    }
    </script>
    b.htm
    <html>
    <body>
    <script>
    var obj = window.opener.document.all("hehe");
    var str = "";
    for(var i=0;i<obj.length;i++){
    if(obj[i].checked){
    str += obj[i].value + "|";
    }
    }
    document.write("你的详细资料<br>");
    document.write("你的姓名:"+ window.opener.document.all("names").value +"<br>");
    document.write("你的学历:"+str.substring(0,str.length-1));
    </script>
    </body>
    </html>