function copyInputSelect(from,newName){ var inputObj = document.createElement('select'); inputObj.setAttribute('class', from.getAttribute('class')); inputObj.setAttribute('name', newName); //loop through the choices opts = from.options; for(var i=0; i<opts.length; i++){ var optionObj = document.createElement('option'); optionObj.text = from.options[i].text; optionObj.value = from.options[i].value; try{ inputObj.add(optionObj,null); //should work in most browsers that support good dom } catch(ex) { inputObj.add(optionObj); //should work in ie, if above fails } } return inputObj;}