Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all, we have some important news to share. Please follow the link here to find out more!

https://www.boards.ie/discussion/2058419143/important-news/p1?new=1

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