English 中文(简体)
当网页更新时,正在浏览哪条表格。
原标题:Keep track of which tab was being viewed when page is refreshed

I have a webpage which has three tabs, and depending on which tab is clicked, the appropriate content is visible. This showing/hiding of the content on clicking of tabs is handled by Javascript.

我的问题是,如果我看一下第三个表格,然后更新该页,那一页没有照亮第三个表格的内容,而是回到第一个表格的内容。

单枪匹马执行时,对我来说,在URL中添加一个GET参数,因此,我的PHP文字能够检查GET的参数并显示正确的内容吗?

最佳回答

Addtab id to the URL as an anchor when tab is clicked, e.g. http://www.mysite.com/page.html#tabId

接着,当页装满时,你会检查一下尿液中是否有刺tab和活性需要打字

问题回答

你有几种选择:

  • use a fragment identifier (add something like #tab3 to the URL)
  • store in a cookie
  • use local storage

根据你们想要支持的浏览器,以及你希望坚持选择的多长时间,你可以选择其中的任何选择。

您可使用厨师或链接<代码>hash。 例如:





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签