title: Getting two frames updated simultaneously using javascript
body: <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  &lt;script language="javascript"&gt;
  var var1 = "&lt;html&gt;&lt;body&gt;Content1&lt;/body&gt;&lt;/html&gt;"
      var2 = "&lt;html&gt;&lt;body&gt;Content2&lt;/body&gt;&lt;/html&gt;"
  function doublelink([arg]){
  top.iframe2.location="javascript:parent.var1";
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;a href="source1" target="iframe1" onClick="doublelink([arg1])";&gt;Link 1&lt;/a&gt;&lt;p&gt;
  &lt;a href="source1" target="iframe1" onClick="doublelink([arg2])";&gt;Link 2&lt;/a&gt;&lt;p&gt;
  
  
  &lt;iframe src="source" name="iframe1"&gt;&lt;/iframe&gt;
  &lt;iframe src="source" name="iframe2"&gt;&lt;/iframe&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I was seeking for method to create links that update multiple frames at a time and found the code above. Without defining argument for the function "doublelink", clicking "Link 1" will put "source1" to "iframe1" and the html in "var1" to "iframe2", and clicking "Link 2" will lead to the same result. Now I want to add an argument, which is related to "javascript:parent.var1" somehow, so that clicking "Link 1" will get "iframe2" filled with "Content1" and clicking "Link2" will put "content2" to the same "iframe2". </p>
  
  <p>There are two ways to get the same outcome:</p>
  
  <ol>
  <li><p>Create another two html files instead of storing them in "var1" and "var2" and give argument relating to their names.</p></li>
  <li><p>Create another "doublelink" function.</p></li>
  </ol>
  
  <p>Method 2 is not optimal, since 100 functions are needed if there are 100 links. Method 1 is normal, but I'm just curious, is there a method to get it done the way I mentioned above? Thank you.</p>