问题描述:
有2个页面:
页面1(choose.html选择游戏模式)
页面2(test.html根据选择的模式进入相应的游戏界面)
实现效果:
通过"游戏模式选择"页面选择游戏模式"一般模式"或"挑战模式",点击"开始游戏"按钮,跳转到页面2,即游戏页面;
要求:当选择"一般模式"时,跳转至页面2后显示一般模式的游戏页面
     当选择"挑战模式"时,跳转至页面2后显示挑战模式的游戏页面
备注:
页面2识别单选框的选择状态,根据选择状态判断进入哪个页面。
这是用jquery写的 火狐浏览器和傲游能运行,IE的不可以
如果不行的话,回答这个问题也可以http://topic.csdn.net/u/20110808/21/5894eecb-d4c0-4fb4-8297-8e82c7c83f4b.html?seed=219152199&r=78625990#r_78625990 
***************************************************************************
以下是页面1和页面2的部分代码:
页面1:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>MemoryMatrix</title><link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"
/>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="../styles/index.css"/><script type="text/javascript">
function Open(){
window.open("test.html");
}
</script></head>
<body><form name="myForm" id="myForm" action="test.html" method="post">
<section id="page_choose" data-role="dialog" data-title="记忆方格">
 <header data-role="header" data-theme="b">
 <h1> 等级选择</h1>
 </header>
    <div class="content" data-role="content" >
 
       <!--选择-->
       <div align="center">
       <p><input type="radio" name="level" id="ordinary" value="0" checked="checked"/><label for="ordinary"> 一般模式</label></p>
       <p><input type="radio" name="level" id="challenge" value="1"/><label for="challenge"> 挑战模式</label></p>
       </div>
   
       <div align="center">
         <a href="#" data-role="button" data-theme="b" data-inline="true" data-icon="grid" data-transition="pop" onclick="Open()" >开始游戏</a>
          <!-- <input type="submit" value="开始游戏" data-theme="b" data-inline="true" data-icon="grid" data-transition="pop"/>-->
          <a href="homepage_c.html" data-role="button" data-theme="d" data-inline="true" data-icon="back" data-transition="pop"> 返回游戏</a>
       </div>
  </form>     
    </div>
</section>
</body>
</html>页面2:
页面2的内容太复杂了,只要告诉我页面2怎么获取页面1中单选框的值就可以了。
例如有个判断
if(self.opener.document.all("level") == 0){ // 获取页面1中的值,我这个随便写的,不能用
alert("ordinary");
}
if(self.opener.document.all("level") == 1){
alert("challenge");
}各位大人帮忙解决一下啊,急急急!

解决方案 »

  1.   

    采用传参方式把值传到第二个页面page2.html?level=1
    然后在页面2中取参数
      

  2.   


    if(self.opener.document.getElementById("ordinary").checked){ 
    alert("ordinary");
    }
    if(self.opener.document.getElementById("challenge").checked){
    alert("challenge");
    }
      

  3.   

    用传参方式的话 page2.html?level=1 这样传过去的不会只是1吗
    第二个页面的脚本怎么写啊 怎么才能接收到呢
      

  4.   

    现在又有一个问题
    <script type="text/javascript">
    function Open(){
    window.open("test.html");
    }
    </script>html中的代码根本没有调用这个函数,<a href="#" data-role="button" data-theme="b" data-inline="true" data-icon="grid" data-transition="pop" onclick="Open()" >开始游戏</a>点击按钮时,没有调用Open
    用这个语句<input type="submit" value="开始游戏" onclick="Open();"/>也不行哭死了