Results 1 to 8 of 8

Thread: || Tab Content Script Help

  1. #1
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow || Tab Content Script Help

    Hello There

    Can someone help with DD Tab Content Script
    http://www.dynamicdrive.com/dynamici...tabcontent.htm

    Ive got it running on a page perfectly

    It uses

    Code:
     onClick="return expandcontent('sc4', this)" 
    to switch to a particular tab (using links on the same page)

    Question

    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..

    at the moment im stuck.

    cheers
    Last edited by void; 07-20-2005 at 08:59 AM.

  2. #2
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    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.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    HTML Code:
    <a href="somepage.htm?var1=sc2">Link Description</a>
    Then you need a decoding script on somepage.htm in its head:
    Code:
    <script type="text/javascript">
    var text=unescape(window.location.href)
    if (text.indexOf('=')!==-1)
    text=text.substr(text.indexOf('=')+1,3)
    else
    text='sc1'
    alert(text)
    </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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    no its not that other guy ..

    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.

    var1=sc3

    it detects the variable and then sets

    var initialtab=[1, PASSEDVARIBLE]

    Else

    var initialtab=[1, "sc1"]



    Code:
    var text=unescape(window.location.href)
    if (text.indexOf('=')!==-1)
    var initialtab=[1, text.substr(text.indexOf('=')+1,3)]
    else
    var initialtab=[1, "sc1"]
    Last edited by void; 07-20-2005 at 12:58 PM.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    Code:
    var value=unescape(window.location.href)
    if (value.indexOf('=')!==-1)
    value=Math.abs(value.substr(value.indexOf('=')+3,1))
    else
    value=1
    var initialtab=[value, "sc"+value]
    We no longer need a separate script, the above code can replace:
    Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 ..


  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jul 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking WOOOP IT WORKS NOW >>>

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •