SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2001
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Storing part of URL as variable.

    I have a FAQ that I built in a jQuery accordion. By default it's all closed, but I want to be able to link directly to a specific question and have that question, along with it's parent containers, to be open if it is passed thru the URL.

    So say I have www.me.com/faq.dml#question15...

    I want to pull out "question15" (or whatever other question is referred to) of the URL (location.href) and store is as a variable in javascript.

    How can I do this? Thanks for helping a newb!
    Steve Davis

  2. #2
    SitePoint Addict
    Join Date
    Sep 2001
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would just pass it like this...

    www.me.com/faq.dml?question=15

    but i also need it to work with JS turned off, and for mobile phones...
    Steve Davis

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    var thingy = location.hash;


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
  •