刷新页面时 select值保持不变 您所在的位置:网站首页 如何刷新网页保留当前页的选项不变 刷新页面时 select值保持不变

刷新页面时 select值保持不变

2024-07-12 12:08| 来源: 网络整理| 查看: 265

刷新页面时,要使下拉菜单(select)、raido保持不变,用ajax是无法实现的。我想只能通过cookies才能实现。刷新前先把select或radio的值保存在cookies中,刷新后再填回去。下面是测试代码:

[html]  view plain       男      女      本科  专科  

 

[javascript]  view plain       function save() {          selectIndex = document.getElementById("sex").selectedIndex;          document.cookie = 'selectIndex =' + selectIndex;          radios = document.getElementsByName("xueli");          for (i = 0; i 


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有