JavaScript & CSS Tab issue on PHP site

Hello,

I am implementing the following CSS tab system:

http://www.my-html-codes.com/javascript-tabs-html-5-css3

However, I would like to use a URL variable to change the tab that should be displayed on page reload.

i.e. http://www.testsite.com/?tab=2

Would default to the 2nd tab being open rather than the first.

The site is running with PHP as well, though I would prefer a pure JavaScript option (and my skills are really rusty).

I have tried to get in touch with the Author but they are not responding.

Thanks in advance.
stirlingitAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
stirlingitConnect With a Mentor Author Commented:
Hmm, thanks for you help but I managed to tap a friend to re-write the JS directly.
d-tabs.js
0
 
Julian HansenConnect With a Mentor Commented:
You should be able to just put the <a> inside the <li> elements and then add onclick="return false;" to the link.

The event should bubble up and the tabs should behave as expected but on the outside it looks like you are clicking the link.
0
 
stirlingitAuthor Commented:
That sounds like a possible solution but if the tabs are only on a single page, say three forms that on single page (forms.php) then how would that work?

As ideally, I would like to use form.php?tab=3 if the user then submits form three.
0
 
Julian HansenConnect With a Mentor Commented:
When you submit a form the button submits to the url of the parent form.
0
 
stirlingitAuthor Commented:
Managed to get a friend to re-write the main code that meant that I only needed to add URL hash tags rather that adding additional script to the main page.
0
All Courses

From novice to tech pro — start learning today.