title: Javascript function change content onclick
body: <p>I am working on a webpage where I would like to have the text in an area change when the user clicks a link. Here is the code for the section of text I would like to change with the js function.</p>
  
  <pre><code>&lt;div id="banner_left"&gt;
  
     &lt;h2 id="tagmain"&gt;This is a title area for the text below - I would like to change this and the below text &lt;/h2&gt;
     &lt;p id="tagtext"&gt;This is the main text area that I would like to change dynamically when a link is clicked.&lt;/p&gt;
     &lt;div class="cleaner_h20"&gt;&lt;/div&gt;
     &lt;div class="button_01"&gt;&lt;a href="#"&gt;More&lt;/a&gt;&lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the code for the link</p>
  
  <pre><code>&lt;div class="banner_button"&gt;
     &lt;a id="support" href="#" onclick="javascript:changeText(args)&gt;Support&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And this is the function code</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
    function changeText(idElement) {
      if(idElement==1){
       document.getElementById.('tagmain').innerHTML ='New title to display';
       document.getElementById.('tagtext').innerHTML ='New text to display.';}
      return false;
   }&lt;/script&gt;
  </code></pre>
  
  <p>The function code will end up with additional conditions to test, but I wanted to get one working first. I'm not quite sure where I went wrong as Java, not Javascript, is my primary language. Any help would be awesome. I would just like to be able to change the content, for example, when a user clicks on the CSS "button"/link for support, rather than changing pages, I would like to change the text in the body of the site.
  Currently it does not appear to do anything.
  Thanks in advance. Hope I'm not being thick on this one :)</p>