need help javascript
•
24 Mar 2008, 12:15
•
Journals
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:
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:
</option doesn't have a closing >! :ooo
In HTML the <option> tag does not have to have an end tag.
In XHTML the <option> tag must be properly closed.
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.
now i can look through the walls
var selectField = document.createElement('select');
ele1.setAttribute('name', 'mappp');
var tmpOption = document.createElement('option');
ele1o2.setAttribute('value', 'Randommap');
selectField.appendChild(tmpOption);
var selectField = document.createElement('select');
selectField.setAttribute('name', 'mappp');
var tmpOption = document.createElement('option');
tmpOption.setAttribute('value', 'Randommap');
selectField.appendChild(tmpOption);
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?
but since i am a noob in js it isnt that easy
i only worked with FarCry and Typo3 CMS and god I hate them.. alot!
but thx for your help <3