Myspace Layouts - Free Advertising - Watch Anime - Justin Gatlin Doping - Property in Bulgaria

PDA

View Full Version : How to create a combobox using divs and javascript


+:::Spider25:::+
Sep 8th 2006, 4:11 pm
Hey Guys, see this thread
http://forums.digitalpoint.com/showthread.php?t=137759

A friend of mine told me about creating a combobox using JavaScript and div's or something like that, Does anybody about made code for this feature I need?

Thanks a lot for the answers

;)

pushkar
Sep 9th 2006, 6:50 am
HI Spider.

For the javascript you should go on URL:http://www.hotjavascripts.com.

best luck.

+:::Spider25:::+
Sep 9th 2006, 4:13 pm
pushkar this site doesn't tell me nothing... I think there was a mistake or misspeling....

+:::Spider25:::+
Sep 21st 2006, 6:38 pm
fck editor

penagate
Sep 27th 2006, 10:12 am
Hi!

A combo box is a select element. Like all elements this can be created through scripting by using DOM functions.

// Create the element:
var combo_box = document.createElement('select');

// Set some properties:
combo_box.name = 'something';

// Add some choices:
var choice = document.createElement('option');
choice.value = 'option1';
choice.appendChild(document.createTextNode('Option 1');
combo_box.appendChild(choice);
choice = document.createElement('option');
choice.value = 'option2';
choice.appendChild(document.createTextNode('Option 2');
combo_box.appendChild(choice);

/* Add it to the page.
Normally you would get a reference to a form element, and add it to that.
Directly within the body, a select element is meaningless.
*/
document.body.appendChild(combo_box);


Hope that gets you started.
- P