title: Javascript Bookmarklet Get Url Variable, Open Multiple Search Windows
body: <p>I tried for months to build this myself before asking but at this stage I'm forced to accept that I will only ever be the worst kind of code-stealing script-kiddie and am terrible at javascript.</p>
  
  <p>Confession over, I need a single bookmarklet that when run, will get 1 variable from the URL (i.e. q=2075083, ALWAYS a 7 digit number, q will always be the id), open 2 new tabs, each one using the variable grabbed to perform a custom search in each of the other two tabs.</p>
  
  <p>There's only one more caveat - I will need to add more search tabs in the future :/</p>
  
  <p>And I'm LOST trying to make it myself. Can anyone lend their expertise or advice?</p>
  
  <p>This is an operation I perform hundreds of times a day, and it would significantly reduce the amount of mouse clicks and copy-paste operations I'll do.</p>
  
  <p>Thank you dearly to anyone who can help or advise.</p>
  
  <p>P.S. I've gotten as far as the code below (which I'll make in to a bookmarklet at a later stage).</p>
  
  <pre><code>function getQueryVariable(variable)
  {
         var query = window.location.search.substring(1);
         var vars = query.split("&amp;");
         for (var i=0;i&lt;vars.length;i++) {
                 var pair = vars[i].split("=");
                 if(pair[0] == variable){return pair[1];}
         }
         return(false);
  }
  </code></pre>
  
  <p>Calling getQueryVariable("q") returns the number I need, but I've no idea how to put it to use creating the two other tabs searching for it.</p>