Still learning the ropes of JavaScript and feeling a bit unsure about my skills.
I'm trying to use JavaScript to create a new window with an input form within it.
Managed to get a basic window set up with a dropdown menu, but struggling to implement a form.
var i, l, options = [{
value: 'fName',
text: 'First Name:'
},
{
value:'lName',
text:'Last Name:'
},
{
value: 'age',
text: 'Age:'
},
{
value:'city:',
text:'City:'
},
{
value:'state',
text:'State:'
},
{
value:'zCode',
text:'Zip Code:'
}
],
newWindow = window.open("", null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
newWindow.document.write("<select onchange='window.opener.setValue(this.value);'>");
for(i=0,l=options.length; i<l; i++) {
newWindow.document.write("<option value='"+options[i].value+"'>");
newWindow.document.write(options[i].text);
newWindow.document.write("</option>");
}
newWindow.document.write("</select>");
newWindow.document.title = "Info Window";
The code above is functional, but I'm having trouble transitioning to a form setup. Any tips or guidance would be highly appreciated.