Click to See Complete Forum and Search --> : creating pull-downs w/javascript...


SKIP3879
01-22-2003, 07:43 PM
i know theres a way to have javascript create this form...

ultimately, theres to be several pull-downs each with the options 1-10.

what am i missing here? i cant seem to set the options.length property on the js created selects...

can anyone help?

maybe i should just take a break...

heres the deal:

<html>

<head>

<title></title>


<!-- ** HEAD SCRIPT ** -->

<script language='javascript'>

function make_form()
{
for (s=0;s<6;s++)
{
document.write
("\n<select name='duh["+s+"]'>\n</select>");
}
document.write("\n</form>\n");

}
<!-- ** 10 OPTIONS EACH ** -->

function ten_each()
{

for (s=0;s<6;s++)
{
document.work_form.duh[s].options.length=3;
}
}

<!------------ ** TRY A LITTLE TEST ** ------->

function test_it()
{
document.work_form.testing.options.length=3;
document.work_form.duh[0].options.length=3;

}


</script>

</head>

<body>

<form name="work_form">
<input type="button" value="Make Form!" onclick="make_form();">
<br><br>
<select name="testing">
</select>
<br><br>
<input type="button" value="test it!" onclick="test_it();">
<br><br>



any help appreciated




skip

SKIP3879
01-23-2003, 02:28 PM
thanks for a very neat phone book script......

it slipped my mind that document.write() wipes-out the page..

i tried collecting all the form tags into a variable, then writing the lot with an onload...

still had problems addressing, like...form.select.option[x] etc..

anyway, i was just trying to save all the redundant typing...

someday ill figure this out..

thanks again...