title: Radio buttons checked changing submit text
body: <p>My site structure consists on an index.php which is styled by a css file. It then includes the following php code in a separate file:</p>
  
  <pre><code>&lt;?php include("globals.php"); ?&gt;
  &lt;form action="&lt;?php echo $website.$relative_string;?&gt;" name="subscribe" onsubmit="javascript:return checkEmail(this);" method="post"&gt;
  &lt;div id="cell8" class="titlecell2"&gt;&lt;h3&gt;Email:&lt;/h3&gt;&lt;/div&gt;
  &lt;div id="cell9" class="inputcell2"&gt;
  &lt;input type="text" class="inputfield2" name="email" value="Your Email..." id="email2" maxlength="255" onfocus="this.value='';"&gt;
  &lt;/div&gt;
  &lt;div id="cell10" class="textcell3"&gt;
  &lt;input name="group" type="hidden" id="group[]" value="&lt;?php echo $group; ?&gt;"&gt;
  &lt;input name="subscribe" id="sub" type="radio" value="true" checked&gt;
  &lt;/span&gt;Subscribe &lt;/p&gt;
  &lt;/div&gt;
  &lt;div id="cell11" class="buttoncell"&gt;
  &lt;button type="submit" name="Submit2" value="Join" id="submitButton2"&gt;
  &lt;span&gt;OK&lt;/span&gt;
  &lt;/button&gt;
  &lt;/div&gt;
  &lt;div id="cell8" class="textcell4"&gt;
  &lt;input type="radio" name="subscribe" id="unsub" value="false"&gt;
  &lt;/span&gt;Un-Subscribe &lt;/p&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>It appears on screen with no problems in the correct layout as my css style sheet. What I would like this to do is when I select the "Subscribe" radio button the submit button text "OK" changes to "Join". When I click on the Unsubscribe button text "OK" or "Join" changes to "Leave".</p>
  
  <p>I tried to make some code from research:</p>
  
  <pre><code>if(document.getElementById('sub').checked) {
      document.write("&lt;span&gt;Join&lt;/span&gt;"
  }
  else if(document.getElementById('unsub').checked) {
      document.write("&lt;span&gt;Leave&lt;/span&gt;)
  }
  </code></pre>
  
  <p>I think this kind of worked in that it changed to Join (replacing the OK line, but obviously didn't update on clicking unsubscribe.  I guess it would update on refreshing the page if my default wasn't join.  I guess I need to do some form of onclick but then I have no idea how to adjust that span ok bit.</p>
  
  <p>Please help?
  Many thanks Chris</p>