Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

URL dependant styling

  • 17-10-2010 02:47PM
    #1
    Registered Users, Registered Users 2 Posts: 15


    I need to implement a quick and dirty hack for the styling of a site, just need some simple styling dependent on the current URL of the page so I can get certain things underlined.

    I'm just unsure what code I'm supposed to be using.
    Would anyone have any pointers?

    Help appreciated.


Comments

  • Registered Users, Registered Users 2 Posts: 15 Duncan1001011


    nvm, I found this:
    function getQuerystring(key, default_)
    {
    if (default_==null) default_="";
    key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if(qs == null)
    return default_;
    else
    return qs[1];
    }


    The getQuerystring function is simple to use. Let's say you have the following URL:


    http://www.bloggingdeveloper.com?author=bloggingdeveloper


    and you want to get the "author" querystring's value:

    var author_value = getQuerystring('author');


Advertisement