我想用js中的付值给一个隐藏属性,传到下一个页面...
这样怎么不行啊------------------at.html-------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function getValue(){
var x = document.getElementById("cat").value;
retun x;
}function get(){
document.getElementById("test").value = getValue();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head><body>
<form action="execg.php" method="get">
<select id="cat">
<option value=1>你好</option>
<option value=2>我好</option>
</select>
<input type="hidden" name="test" id="test">
<input type="submit" onclick="get();">
</form>
</body>
</html>
------------------------execg.php---------------------------
<?php
echo $_GET['test'];
?>
这样怎么不行啊------------------at.html-------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function getValue(){
var x = document.getElementById("cat").value;
retun x;
}function get(){
document.getElementById("test").value = getValue();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head><body>
<form action="execg.php" method="get">
<select id="cat">
<option value=1>你好</option>
<option value=2>我好</option>
</select>
<input type="hidden" name="test" id="test">
<input type="submit" onclick="get();">
</form>
</body>
</html>
------------------------execg.php---------------------------
<?php
echo $_GET['test'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function getValue(){
var x = document.getElementById("cat").value;
retun x;
}function get(){
document.getElementById("test").value = getValue();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here </title>
</head><body>
<form action="execg.php" method="get" onsubmit="get();"> <!--加在这里看看。-->
<select id="cat" onchagne="get();"><!--或加在这里看看。-->
<option value=1>你好 </option>
<option value=2>我好 </option>
</select>
<input type="hidden" name="test" id="test">
<input type="submit">
</form>
</body>
</html>
------------------------execg.php---------------------------
<?php
echo $_GET['test'];
?>
function getValue(){
var x = document.getElementById("cat").value;
retun x;
} 呵呵,错了retun /return ;