Results 1 to 2 of 2

Thread: Using a query string to change css 'ID' name

  1. #1
    Join Date
    Oct 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using a query string to change css 'ID' name

    Without going into too much detail (coz it's a bit complicated), does anyone know how to change the '1' in the CSS ID name '#link1' below, using a query string?

    I've played around by trying to make the ID name into a variable (www.mysite.com?myLink=2 etc), but I don't know what I'm doing?

    <link href="myFonts.css" rel="stylesheet" type="text/css">

    <style type="text/css">
    #link1 {
    background-color: #D7EBB0;
    }
    </style>

    </head>

    I would be very grateful if someone can tell me please?

    Jim

  2. #2
    Join Date
    Jan 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    I have a similar problem.

    I know you can get the query string from the page's url with window.location.search, but evaluating that string is another matter. I would like to be able to get values from a string using a function.

    For example:
    url?firstname=john&lastname=smith
    A function call such as:
    Code:
    getQueryStringValue('lastname');
    should return 'smith'.

    I'm guessing this would involve using regular expressions somehow, but this is definitely not my area of expertise.

    It would also be nice to be able to change values in the query string,

    for example:
    Code:
    changeQueryStringValue('lastname','brown');
    should change the url to:
    url?firstname=john&lastname=brown

    Thanks for your help

    EDIT: Found another post which answers my question: http://www.dynamicdrive.com/forums/s...t=query+string
    Last edited by Agrajag; 10-13-2006 at 08:28 AM.

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
  •