title: Passing parameters to JavaScript files
body: <p>Often I will have a JavaScript file that I want to use which requires certain variables be defined in my web page.</p>
  
  <p>So the code is something like this:</p>
  
  <pre><code>&lt;script type="text/javascript" src="file.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
     var obj1 = "somevalue";
  &lt;/script&gt;
  </code></pre>
  
  <p>But what I want to do is:</p>
  
  <pre><code>&lt;script type="text/javascript" 
       src="file.js?obj1=somevalue&amp;obj2=someothervalue"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I tried different methods and the best one yet is to parse the query string like this:</p>
  
  <pre><code>var scriptSrc = document.getElementById("myscript").src.toLowerCase();
  </code></pre>
  
  <p>And then search for my values.</p>
  
  <p>I wonder if there is another way to do this without building a function to parse my string.</p>
  
  <p>Do you all know other methods?</p>