如何才能使页面刷新后不清空已选的下拉框的值.如我的代码是这样的:
function ock_check(inttype)
{
switch(inttype){
case 1:
document.all.frm1.target="eopframe_option";
document.all.frm1.action="GrowEspial_add.php";
document.all.frm1.submit();
break;
..........................................................................<select name="InoculPass_BatchNo0" id="InoculPass_BatchNo" tag="str,0,批号">
<option value=""></option>
<?php
$sql="select InoculPass_BatchNo from InoculPass where Germ_No='".$Germ_No0."' and InoculPass_DelFlag=0 order by InoculPass_BatchNo ASC";
$query=mysql_query($sql);
while($result=mysql_fetch_assoc($query)){
printf("<option value='%s'>%s</option>\n",$result['InoculPass_BatchNo'],$result['InoculPass_BatchNo']);
}
echo "</select>";
?>怎么样才能使我的页面刷新后还显示着我已选定的option值呢
function ock_check(inttype)
{
switch(inttype){
case 1:
document.all.frm1.target="eopframe_option";
document.all.frm1.action="GrowEspial_add.php";
document.all.frm1.submit();
break;
..........................................................................<select name="InoculPass_BatchNo0" id="InoculPass_BatchNo" tag="str,0,批号">
<option value=""></option>
<?php
$sql="select InoculPass_BatchNo from InoculPass where Germ_No='".$Germ_No0."' and InoculPass_DelFlag=0 order by InoculPass_BatchNo ASC";
$query=mysql_query($sql);
while($result=mysql_fetch_assoc($query)){
printf("<option value='%s'>%s</option>\n",$result['InoculPass_BatchNo'],$result['InoculPass_BatchNo']);
}
echo "</select>";
?>怎么样才能使我的页面刷新后还显示着我已选定的option值呢
<select name="select">
<?
for($i = 0;$i<=4;$i++){
$str = '';
if ($_POST['select'] == $i) {
$str = "selected";
}
echo "<option value=".$i." {$str}>$i</option>";
}
?>
</select>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</form>
<body>
<style>
.userData {behavior:url(#default#userdata);}
</style>
<select id="select1" class="userData">
<option>option1 </option>
<option>option2 </option>
<option>option3 </option>
<option>option4 </option>
</select>
<script>
var obj=document.all.select1;
obj.attachEvent('onchange',saveSelectedIndex)
function saveSelectedIndex(){
obj.setAttribute("sSelectValue",obj.selectedIndex);
obj.save("oSltIndex");
}
window.attachEvent('onload',loadSelectedIndex)
function loadSelectedIndex(){
obj.load("oSltIndex");
obj.selectedIndex=obj.getAttribute("sSelectValue");
}
</script>
揭贴率:-11.76%,提醒LZ尽快结帖.