title: I have this python script, I'd rather use JavaScript
body: <p>I have this chunk of Python that I cobbled together from various sources (I am not a programmer or developer or even in any kind of technical trade, I just needed something to automate some processes).  This is not the actual specific script, but it's written and works the same way:</p>
  
  <pre><code>import os
  os.system('cls')
  
  from sys import argv
  
  script, filename = argv
  
  print "MADLIBS!"
  
  print "If %r exists, it will be erased." % filename
  print "To abort, hit CTRL-C (^C)."
  print "To proceed, hit RETURN."
  
  raw_input("?")
  
  os.system('cls')
  
  print "Opening file %r..." % filename
  target = open(filename, 'w')
  
  print "Overwriting file %r." % filename
  target.truncate()
  
  analyst = raw_input("Please enter the title of this madlib: ")
  appdate = raw_input("Please enter your name: ")
  print
  
  print "Thank you.  Please enter the following information:"
  print
  
  verb    = raw_input("   Enter a verb:           ")
  noun    = raw_input("   Enter a noun:           ")
  
  
  print "Thank you."
  
  
  target.write("&lt;!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'&gt;")
  target.write("\n")
  target.write("&lt;html xml:lang='en' xmlns='http://www.w3.org/1999/xhtml' lang='en'&gt;")
  target.write("\n")
  target.write("&lt;head&gt;")
  target.write("\n")
  target.write("&lt;meta http-equiv='content-type' content='text/html; charset=UTF-8'/&gt;")
  target.write("\n")
  target.write(appdate)
  target.write("'s Madlib story!")
  target.write("&lt;p&gt;")
  target.write("Go ")
  target.write(verb)
  target.write(" a ")
  target.write(noun)
  target.write(".")
  
  target.write("&lt;p&gt;")
  target.write("&lt;p&gt;")
  target.write("&lt;p&gt;")
  
  target.write("&lt;a href='javascript:window.print()' title='Send to printer'&gt;Send to printer&lt;/a&gt;&amp;nbsp;&amp;nbsp;")
  target.write("\n")
  target.write("")
  target.write("\n")
  target.write("&lt;script language='VBScript'&gt;")
  target.write("\n")
  target.write("    Sub Window_Onload")
  target.write("\n")
  target.write("      window.opener = 'x'")
  target.write("\n")
  target.write("    End Sub")
  target.write("\n")
  target.write("&lt;/script&gt;")
  target.write("\n")
  target.write("")
  target.write("\n")
  target.write("\n")
  
  target.write("&lt;a href='javascript:self.close()' title='Close this window'&gt;Close this window&lt;/a&gt;")
  target.write("\n")
  
  target.write("&lt;/body&gt;")
  target.write("\n")
  target.write("&lt;/html&gt;")
  
  target.close()
  os.system(filename)
  </code></pre>
  
  <p>It creates an HTML document using input gathered from the user via Python.  It essentially does what I want it to do, but I'm starting to think Python is not the best route to get what I want here (I only created the script because I was curious about Python and wanted to try creating something).  Can anyone give any general advice on doing something similar using JavaScript (rather than Python) to gather user input <em>in</em> a browser window and display it <em>to</em> the browser window?  </p>
  
  <p>I realize there is a certain amount of general clumsiness with the way the code is put together and it's not particularly elegant, but that's something I can deal with later.  For now, I'd just like a JavaScript version of it to work so I can tweak and refine it later. Any suggestions?</p>