View Full Version : || Tab Content Script Help

07-20-2005, 08:38 AM
Hello There

Can someone help with DD Tab Content Script

Ive got it running on a page perfectly

It uses

onClick="return expandcontent('sc4', this)"

to switch to a particular tab (using links on the same page)


Now can you have a link on another page that can link directly to particular tab ?? so when you click on the link when the page loads it loads with that particular tab selected.

Any thoughts or help would be fantastic.. :D

at the moment im stuck.


07-20-2005, 09:31 AM
Just another Javascript question ..

Can a link on one page

trigger a javascript function on another page?

if so this would solve the previous question.

07-20-2005, 12:07 PM
Is this really 'EliteSeraphim' in disguise trying to dumb down a previous question? You can pass information using javascript and html to a page via the link:

<a href="somepage.htm?var1=sc2">Link Description</a>
Then you need a decoding script on somepage.htm in its head:

<script type="text/javascript">
var text=unescape(window.location.href)
if (text.indexOf('=')!==-1)
</script>This is oversimplified but, will work in this specific case. Instead of alert(text), you can do whatever you want with the value now stored in the variable 'text', which in this case would be 'sc2'. As long as you can be guaranteed that 'somepage.htm' will always and only be called using this = convention or none at all, text will be what you send from the calling page (with a three character limit ex: sc22 will become sc2) or 'sc1' if nothing is sent.

07-20-2005, 12:39 PM
no its not that other guy :D ..

I just looked and found what you have been talking about..

It looks like what im trying to do too.

any clues on a solution its messing with my head grin.

im not a great javascript user

But using your code could this work ..

ie if there was some passed variable i.e.


it detects the variable and then sets

var initialtab=[1, PASSEDVARIBLE]


var initialtab=[1, "sc1"]

var text=unescape(window.location.href)
if (text.indexOf('=')!==-1)
var initialtab=[1, text.substr(text.indexOf('=')+1,3)]
var initialtab=[1, "sc1"]

07-20-2005, 02:24 PM
Well basically yes but, doesn't the 1 in initialtab also have to change? If so, and it looks like it does, and looks like we are in luck because it is the same number. Now our receiving code could look like this:

var value=unescape(window.location.href)
if (value.indexOf('=')!==-1)
var initialtab=[value, "sc"+value]We no longer need a separate script, the above code can replace:

var initialtab=[1, "sc1"]in the original script. The sending link would be the same as before and this still would only work for sc1 through sc9.

07-20-2005, 02:45 PM
the above works great but it not triggering the tab change ..

local links use onClick="return expandcontent('sc1', this)

so its the expandcontent function that hides any existing tabs
and shows the new tab.

just by affecting the

var initialtab=[value, "sc"+value]

client side doesnt trigger the change ..

but i feel its getting closer to being solved ..


07-20-2005, 02:55 PM
Well it is for links to the page not on the page. Gotta run, will have a closer look at what you are shooting for later.

07-20-2005, 02:58 PM
Cracked it WHOOOP

//Dynamicdrive.com persistence feature add-on

var enablepersistence=false //true to enable persistence, false to turn off (or simply remove this entire script block).

Had the persistence turned to true .. was forcing the tab to be that of the cookie :)

WHoopt !
Cheers jscheuer1 !!! 10 gold stars to you !!

maybe i should learn more indepth javascript :rolleyes: