代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ZWOA</title>
<style type="text/css">
option{font-size:15px;background:#cfc;width:50px};
body{font-size:20px};
table{font-size:15px;border:0px;font-family:'宋体';border-color:gray};
td{background:#fce;width:600px;};
#heade-image{background:url(head.jpg) no-repeat:no;height:100px;color:#cfc;font-size:30px};
A{font-size:16px;};
</style>
<script type="text/javaScript">
//取得select中被选择中的索引的js函数
function getValue()
{
var select_name=document.test.late_name;
for(var f=1;f<select_name.length;f++){
if(select_name[f].selected==true){
var sel_id=parseInt(f);
if(sel_id==0){
alert('admin');
}
else{
alert(sel_id+'号被选中');
}
return sel_id;
}
}
}
//隐藏控件的值
function hiddenValue(){
var hValue=document.getElementById("hidd").value=getValue();
return hValue;
}
//表单中默认上一次选择值的JS函数(页面刷新时)
function commonValue(){
window.document.test.late_name.value=getValue();
}
//表单中默认上一次选择值的JS函数(翻页时)
function pageTimeValue(){
var k=window.parent.document.test.late_name.value= hiddenValue();
window.document.test.late_name.value=k;
<?php session_start(); ?>
}
</script>
</head>
<div id=heade-image>考勤统计</div>
<body onload="pageTimeValue(),commonValue()">
<?php
//从表单得到用户ID
$employ_id_num=intval($_POST["late_name"])+1;
//分页显示参数
$page=$_GET['page'];
if(isset($page)){
$page=$page;
}
else{
$page=1;
}
$nextPage=$page+1;
$previous_page=$page-1;
if($previous_page<1){
$previous_page=1;
}
$pageSize=12;
$nowPage=intval(($page-1)*$pageSize);
?>
<?php
$link=mysql_connect("192.168.1.5:20071","zwoa","999999");
$db=mysql_select_db("zwoa",$link);
$result=mysql_query("select * from employee_info");
for($i=0;$i<10;$i++){
//用来自动生成选择列表
mysql_data_seek($result,$i);
$rows=mysql_fetch_row($result);
$name[$i][1]= $rows[1];
$id[$i][0]=$rows[0];
}
?>
<?php
//取得详细结果
$sql_late=" select a.attendance_date,a.employee_id,b.name from attendance a left join  employee_info b on a.employee_id=b. employee_id where a.status=\"迟到\" && b.employee_id=$employ_id_num limit $nowPage,12"; 
$rs=mysql_query($sql_late);
for($j=0;$j<100;$j++){
$row=mysql_fetch_row($rs);
$late_nameOK[$j][2]=$row[2];
$late_time[$j][0]=$row[0];
$late_id[$j][1]=$row[1];
}
?>
<?php
//取得每个人迟到记录的总次数
$sql_total="select count(*) from attendance where status=\"迟到\" and employee_id=$employ_id_num ";
$total_num_result=mysql_query($sql_total);
$row=mysql_fetch_array($total_num_result);
$total_num=$row[0];
?>
<form  action="lookup.php?page=<?=$page?>"  method="POST" name="test" onSubmit="getValue()">
<table  border=1>
<tr>
<td>请选择
<select  name="late_name" id="lateid">
<? for($i=0;$i<10;$i++) {?>
<option value=<?=$i?>> <?php echo $name[$i][1]; ?>
</option>
<?}?>
</select>
<input type="hidden" name="hiddenValue" value="" id="hidd">
<input type="submit" value="GO"></td>
</form>
<th>&nbsp;&nbsp;&nbsp;Name</th>
<th>&nbsp;&nbsp;Late_date</th>
<th>&nbsp;&nbsp;total_late_time</th>
</tr>
<tr>
<td style={background:url(grass.jpg) no-repeat;border:0px;}></td>
<td height=400>&nbsp;&nbsp;<?php for($j=0;$j<12;$j++) echo '<ul>'.$late_nameOK[$j][2].'</ul>'; ?></td>
<td height=400>&nbsp;&nbsp;<?php for($j=0;$j<12;$j++) echo'<ul>'. $late_time[$j][0].'</ul>';?></td>
<td height=400>&nbsp;&nbsp;<?='你已有<font color=red size=5>'.$total_num.'</font>次迟到'?></td>
<?php
echo "<a href=lookup.php?page=1>首页</a>";
echo "<a href=lookup.php?page=".$nextPage.">下一页</a>";
echo "<a href=lookup.php?page=".$previous_page.">上一页</a>";
?>
<?php 
mysql_close($link);
?>
我想要实现的是:点击上一页或下页时,表单select 中的值不变,请问一下用JS怎么实现?