刷新的时候页面重新载入,自然一切都恢复初始状态。
建议用隐藏表单存储下拉菜单的值,或者在页面刷新的时候直接把参数写上。
比如:
<script language="JavaScript">
function refreshPage() {
obj1 = document.all("sel1");
obj2 = document.all("sel2");
para1 = obj1.options[obj1.selectedIndex].value;
para2 = obj2.options[obj2.selectedIndex].value;
document.location.href = "xx.asp?para1="+para1+"¶2="+para2;
}
</script>
<select name="sel1" onChange="javascript:refreshPage()">
...
</select>
<select name="sel2">
...
</select>
然后再select中根据传递过来的para来判断哪个option初始被选中。
不知道这样是否复杂了点,我一直是这样做的,不妨一起研究研究。
建议用隐藏表单存储下拉菜单的值,或者在页面刷新的时候直接把参数写上。
比如:
<script language="JavaScript">
function refreshPage() {
obj1 = document.all("sel1");
obj2 = document.all("sel2");
para1 = obj1.options[obj1.selectedIndex].value;
para2 = obj2.options[obj2.selectedIndex].value;
document.location.href = "xx.asp?para1="+para1+"¶2="+para2;
}
</script>
<select name="sel1" onChange="javascript:refreshPage()">
...
</select>
<select name="sel2">
...
</select>
然后再select中根据传递过来的para来判断哪个option初始被选中。
不知道这样是否复杂了点,我一直是这样做的,不妨一起研究研究。
谢谢 ,原有问题已解决,刚接触asp,总碰到些问题。
希望以后多帮忙!