need help javascript

dear xfire

i need some help with javascript:

var ele1 = document.createElement('input');
ele1.setAttribute('type', 'text');
ele1.setAttribute('name', 'map_name[]');
ele1.setAttribute('id', 'map_name_' + inkrement);
ele1.setAttribute('size', '35');
ele1.className='form_off';
cell1.appendChild(ele1);

that thingy gives me a little textarea but i need a <select><option></option></select> - area and i dunno how to do that

any suggestions?


Random Pic:
image: SuperHeros
Comments
13
<select><option></option</select>

</option doesn't have a closing >! :ooo
yes no need for the option tag but u can close it if you want ^^
Parent
Proper coding guidelines advices to use a closing tag.

In HTML the <option> tag does not have to have an end tag.

In XHTML the <option> tag must be properly closed.
Parent
perhaps you should start with creating a select element instead of an input element ;)

selectField = document.createElement('select');

and after that make some option elements:

tmpOption = document.createElement('option');

and use the selectField to append the options to it:

selectField.appendChild(tmpOption);

and do this for all the options you need.
ssshhhtt, this is the new gamehack strings to post!
Parent
thx for your help <3

now i can look through the walls
Parent
smth like that?

var selectField = document.createElement('select');
ele1.setAttribute('name', 'mappp');

var tmpOption = document.createElement('option');
ele1o2.setAttribute('value', 'Randommap');

selectField.appendChild(tmpOption);
Parent
nah,

var selectField = document.createElement('select');
selectField.setAttribute('name', 'mappp');

var tmpOption = document.createElement('option');
tmpOption.setAttribute('value', 'Randommap');

selectField.appendChild(tmpOption);
Parent
exactly as Ronner said,

create the select element, create the options elements, append the option tags to the select and finally append the select to the body, div or wotever you have

im not an expert in javascript yet but i think thats the logic one have to use. never seen this kind of code until today =o

may i ask why are you creating elements with javascript?
well its an opensource cms called webspell ;) and i am editing it for trying random things + learn smth about php html js....

but since i am a noob in js it isnt that easy
Parent
ah ok, taught you wanted to show elements on some sort of javascript function which can be dealt in an easier way. nvm then, and gl

i only worked with FarCry and Typo3 CMS and god I hate them.. alot!
Parent
yes i think ill need some luck...

but thx for your help <3
Parent
Back to top