<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<input type="text" name="name1"><br /><br />
<input type="text" name="name2"><br /><br />
<input type="submit" id="sub">
</body>
<script>
$(function(){
$("#sub").click(function(){
if(confirm("确定要提交吗")) {
var val1 = $("[name='name1']").val()
var val2 = $("[name='name2']").val()
window.location.href="2.html?name1="+val1+"&name2="+val2
}
return false
})
})
</script>
</html>
2.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
</body>
<script>
$(function(){
var url = location.search
alert(url)
})
</script>
</html>
<!DOCTYPE html><html>
<head>
<meta charset="utf-8" />
<title>无标题文档</title>
<style>
#group1 {
width: 350px
padding-left: 20px
line-height: 30px
}
.spanCss {
font-size: 28px
}
</style>
<script>
var ck=function(cc){
var cs=group1.querySelectorAll("input[type=checkbox]")
var num=0
for(var i=0i<cs.lengthi++){
if(cs[i].checked){
num++
}
}
cc.innerHTML=cs.length+"个选项,选中"+num+"个"
}
</script>
</head>
<body>
<p>大学学习目的:</p>
<fieldset id="group1">
<legend>
<label>
<input type="checkbox" />学习知识,提高技能</label>
<br />
<label>
<input type="checkbox" />培养终生学习能力</label>
<br />
<label>
<input type="checkbox" />促进心智成长</label>,增强表达、沟通、协作能力
<br />
<label>
<input type="checkbox" />构建人脉</label>
<br />
</legend>
</fieldset>
<p>要求实现的功能:</p>
<p><span class="spanCss" onclick="ck(this)">单击这里显示:?个选择项,选中?个</span>
</p>
</body>
</html>