<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">test1.html</span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">
</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><!DOCTYPE html></span>
<html>
<head>
<meta charset="utf-8">
<title>test1.html页面</title>
<script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
</head>
<body>
请输入:
<input type="text" id="txta" >
<br />
第一种方式,传输入的值
<input type=button value="去往test2.html页面" οnclick="tiaozhuan()" />
<script type="text/javascript">
var tiaozhuan = function(){
document.location.href ='test2.html?mydata1=' + $("#txta").val();
}
</script>
<br />
第二种方式,传固定的值
<input type=button value="去往test2.html页面" οnclick="document.location.href ='test2.html?mydata1=ciweigudingzhi';" />
</body>
</html>
test2.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test2.html页面</title>
</head>
<body>
test1.html页面传来的值为:<input type=text id="txt1" />
<script type="text/javascript">
var txt1 = document.getElementById("txt1");
txt1.value = location.search.match(new RegExp("[\?\&]mydata1=([^\&]+)", "i"))[1];
</script>
</body>
</html>