Hi again!
I'm writing a page that uses select boxes. One thing I would like to do when a selection is made in the select boxes is to generate another set of blank boxes, ad infinitum.
I understand this is a fairly simple thing, but am new to javascript (as in starting to learn it as I post this).
EDIT: Altered title and text to reflect purpose of post.
javascript endless select boxes
Moderator: General Moderators
javascript endless select boxes
Last edited by Bal on Fri May 30, 2008 8:03 pm, edited 1 time in total.
Re: PHP?
yea this is a client-side issue. this isn't something php would be capable of unless you actually submitted the page to the server.
Moving to client side...
EDIT: oh and you may want to change the title of your thread to something like "how do you generate a select box with javascript?" or something like that.
Moving to client side...
EDIT: oh and you may want to change the title of your thread to something like "how do you generate a select box with javascript?" or something like that.
Re: javascript endless select boxes
JS to create select box:
Code: Select all
var select = document.createElement('select');
select.name = 'new_select';
document.getElementsByTagName('body')[0].appendChild(select);
for(var i=0; i<10;i++) {
var option = document.createElement('option');
option.value = i;
option.innerHTML = 'Value ' + i;
select.appendChild(option);
}