title: Javascript with python cgi not giving expected results
body: <p>In the below Python CGI script, I am using javascript function for changing the picture on click. But apparently it doesn't seems to work. I am following the example from <a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_lightbulb" rel="nofollow">w3 schools js example</a>. So I just want to conform, is it possible to use the javascript inside Python CGI script.</p>
  
  <p>If same example has to be done in Python, what should be the approach.</p>
  
  <pre><code>#!/usr/bin/env python
  
  import cgi
  
  print """print "Content-type: text/html; charset=utf-8
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;script&gt;
  function changeImage()
  {
  element=document.getElementById('myimage')
  if (element.src.match("bulbon"))
    {
    element.src="../pic_bulboff.gif";
    }
  else
    {
    element.src="../pic_bulbon.gif";
    }
  }
  &lt;/script&gt;
  
  &lt;img id="myimage" onclick="changeImage()"
  src="../pic_bulboff.gif" width="100" height="180"&gt;
  
  &lt;p&gt;Click the light bulb to turn on/off the light&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  """
  </code></pre>