Adnan’s Blog

Posts Tagged ‘javascript

I recently came across a very nice jQuery control library called jQuery Tools. The library features the following JavaScript tools :

  1. Tabs
  2. Tooltips
  3. Expose
  4. Overlay
  5. Scrollable
  6. FlashEmbed

So now you are thinking “Whats so great about this? We already have tons of jQuery plugins for this…”. I thought so too.

The striking advantage of this library is that these tools can be combined, extended and styled, giving you potentially unlimited options for creating customized widgets for your web pages. The website also features great and detailed examples to help you get started, and features some of the best practices recommended by Yahoo engineers. [ref : Best Practices for speeding up your website]

Here’s a small javascript helper to read Url Query String Parameters.

function GetUrlParams()
          var vars = [], hash;
           var hashes = window.location.href.slice(window.location.href.indexOf(‘?’) + 1).split(‘&’);

        for(var i = 0; i < hashes.length; i++)
                hash = hashes[i].split(‘=’);
                vars[hash[0]] = hash[1];
        return vars;

The above function, will read the url, get the query string part i.e from (“?”) and split each paramter by the (“=”) character and create a name value pair allowing us to access the param value using the param name.


For example, if we are have a test.htm in and the url is :

To access the param values we can use something like :

var params = GetUrlParams();