//append at the end of select
function addKeyword()
{
var k = document.getElementById("word").value;//get the data from a text filed
var elOptNew = document.createElement('option');
elOptNew.text = k ;
elOptNew.value = k ;
var elSel = document.getElementById("words");//words is the html select control id
try {
elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
}
catch(ex) {
elSel.add(elOptNew, elSel.selectedIndex); // IE only
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment