开发者

Want to Open a new Tab by appending parameter in the querystring

I want to open a new tab when thru the parameter in the query string.

For an example,I have four tabs (t1, t2,t2,t4). Right now, i have implemented the code that whenever user puts http://abc.net/disc_apps.jsp#tab3, it automatically opens tab3.For that i have written a function in document.ready, so for that I need to refresh the page or have to open a new tab and then have to enter a new query string.

Bu开发者_开发百科t, now i am trying to implement http://abc.net/disc_apps.jsp?defaultTab=tab3 functionality, where i don't have to open a new tab every time or don't have to refresh the page.

please help me as I am new to these things.

thanks in advance. Hemish


After deciphering the question and reading the comments up to three times, your concrete problem turns out to be the following:

I want to change the hash fragment in the URL when I change a tab in the UI.

Using query strings isn't the solution. They are server side and not controllable from the client side on without firing a HTTP request (or, "refreshing the page" as you call it yourself). Hash fragments are however controllable from the client side on. It's extraordinary easy as well: just use it as-is in tab links.

<a href="#tab1">tab1</a>
<a href="#tab2">tab2</a>
<a href="#tab3">tab3</a>

The webbrowser will change the hash fragment in the browser address bar by itself. I however assume that you already have a jQuery function which already shows the desired tab content when any of those links is clicked (and doesn't return false from the function!).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜