【发布时间】:2014-10-27 03:16:35
【问题描述】:
我尝试获取位于第一个 html 页面上的底部粘贴的 html 代码的值。我有另一个 html 页面,应该使用“onclick”按钮生成。更准确地说,代码应该在下一页中创建按钮。
案例 1: 选择了 radio-choice-1 - 它应该创建 4 个按钮。
案例 2: 选择了 radio-choice-2 - 它应该创建 4 或 9 个按钮。
案例 3: 选择了 radio-choice-3 - 它应该创建 9 或 16 个按钮。
案例 4: 选择了 radio-choice-4 - 它应该创建 16 个按钮。
我不知道如何获取所选单选按钮的值,然后在另一个页面上生成按钮。
我其实有一点脚本(game.js):
$(document).ready(function(){
$('#radio-button-value').click(function(){
$("input[name='radio-button-gruppe']:checked".val());
});
});
第一个 html 页面
<html>
<head>
<meta charset="utf-8" />
<title>newgame</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<!-- Einstellungen zur Defintion als WebApp -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="game.js"></script>
</head>
<body>
<div data-role="main" class="ui-content">
<form>
<fieldset data-role="controlgroup">
<legend>Choose a mode:</legend>
<input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" checked="checked">
<label for="radio-choice-1">easy</label>
<input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2">
<label for="radio-choice-2">medium</label>
<input type="radio" name="radio-choice" id="radio-choice-3" value="choice-3">
<label for="radio-choice-3">difficult</label>
<input type="radio" name="radio-choice" id="radio-choice-4" value="choice-4">
<label for="radio-choice-4">hard</label>
</fieldset>
<input type="button" id="radio-button-value" name="game" value="create game" class="button" data-theme="b"/>
</form>
</div>
<div data-role="footer">
</div>
</div>
</body>
</html>
【问题讨论】:
-
按照以下问题的建议使用 cookie。这就是饼干的用途。存储数据位。
标签: javascript jquery html jquery-mobile web-applications