复制代码 代码如下:
<script type="text/javascript">
window.onload = function () {
var cooki = document.cookie;
if (cooki != "") {
cooki = "{/"" + cooki + "/"}";
cooki = cooki.replace(//s*/g, "").replace(/=/g, '":"').replace(/;/g, '","');
var json = eval("(" + cooki + ")"); //将coolies转成json对象
document.getElementById("selectID").options[json.selIndex].selected = true;//保持原来的选项
}
else
save();
}
function change()
{
selectIndex = document.getElementById("selectID").selectedIndex;
document.cookie = 'selIndex =' + selectIndex;//保存在cookie中,键名为selIndex
}
</script>
新闻热点
疑难解答