title: Javascript Change DIV background color onclick
body: <p>I'm trying to change the colour of a div after a form has been submitted.  The div on the new  page should be in the colour selected.</p>
  
  <p>JS</p>
  
  <pre><code> function change(col) {   
       col.style.backgroundColor = '&lt;?php echo $colour ?&gt;';    
   }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;form action="" method="post"&gt;
      &lt;input type='search' name='keywords' value='' style="width:100%;"&gt;
  &lt;a href='#col'&gt;
  &lt;input type=submit  value='Submit' name='doSearch' style="visibility: hidden;" onclick="change(this.href)" /&gt;
   &lt;/a&gt;
  
  &lt;/form&gt;
  &lt;div id="col" onclick="location.href='index2.php';"&gt;
      &lt;br/&gt;
      &lt;?php echo $message ?&gt;
  &lt;/div&gt;
  </code></pre>