如何保存“扩展”的内容单击 IE 中的后退按钮时,使用 JavaScript 的附加表单字段的状态?
我有一个带有两个单选按钮的表单。单击其中一个单选按钮时,JavaScript 将使用 display: block 设置一组子字段。
如何才能使选定的单选按钮和子字段在单击 IE 中的后退按钮时展开? Webkit 或 Firefox 中不会出现此问题。
它需要使用纯 JavaScript,所以不需要 jQuery!
I have a form that has two radio buttons. When one of the radio buttons is clicked, JavaScript is used to set a group of sub-fields using display: block.
How can I make it so the selected radio button and sub-fields will expand when clicking the back button in IE? This issue does not occur in Webkit or Firefox.
It needs to work with plain JavaScript, so no jQuery!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种流行的方法是使用 URL-hash 来表示 UI 状态。当 UI 发生变化时,您会构建一个哈希值:
当您重新加载页面时,查看哈希值并使用 JavaScript 设置相关的 UI 元素。如何表示元素取决于您。
One popular methods is to use a URL-hash to represent the UI state. As the UI changes, you build up a hash:
When you re-load the page, look at the hash and use JavaScript to set the relevant UI elements. How you represent your elements is up to you.