Original Post
I'm trying to dynamically write a form on a page I am creating. When I call the javascript from my html document the elements aren't being written. Could someone tell me what I'm doing wrong??
// JavaScript Document
var resTitle = "Site Resource"; // this will get changed to the name of the resource
var netID = "testID"; // change this id to the id where the email will be sent to.
function generateForm()
{
resTitle = this.document.getElementById("resourceTitle").innerHTML;
if(!resTitle)
{
resTitle = "Site Resource";
}
this.document.writeln("<form method='post' action='https://www.lefthandinteractive.com/mytest.cgi'>");
this.document.writeln("<input name='netid' type='hidden' value='", netID,"' />");
this.document.writeln("<input name='subject' type='hidden'", "value='", resTitle, "' />");
this.document.writeln("<input name='required' type='hidden' value='email' />");
this.document.writeln("Email:(Required)<input name='email' type='text' value='' size='30' maxlength='60' />
");
this.document.writeln("How would you rate this resource?
");
this.document.writeln("<input name='rating' type='radio' value='1' />1 (lowest)" );
this.document.writeln("<input name='rating' type='radio' value='2' />2");
this.document.writeln("<input name='rating' type='radio' value='3' />3");
this.document.writeln("<input name='rating' type='radio' value='4' />4");
this.document.writeln("<input name='rating' type='radio' value='5' />5 (highest)
");
this.document.writeln("How did you learn about this website?
");
this.document.writeln("<input name='reference' type='radio' value='Through a search engine?' />Through a search engine?
");
this.document.writeln("<input name='reference' type='radio' value='From a colleague?' />From a colleague?
");
this.document.writeln("<input name='reference' type='radio' value='From another webpage (which one?)' />From another webpage (which one?)<input name='reference' type='text' value='' size='30' maxlength='60' />
");
this.document.writeln("<input name='reference' type='radio' value='From a teacher?' />From a teacher?
");
this.document.writeln("<input name='reference' type='radio' value='Other (please specify)' />Other: <input name='othSource' type='text' value='' size='30' maxlength='60' />
" );
this.document.writeln("Comments:
");
this.document.writeln("<textarea name='feedback' rows='4' cols='32'></textarea>
");
this.document.writeln("<input type='submit' value='Send the form' />", "<input type='reset' value='Reset the form' />");
this.document.writeln("</form>");
}