Open Source & Stuff  
  |     Main Site     |      Forum     |     Contact     |
Java script :  forum.Salix.gr forum.Salix.gr
Little scripts that might be helpful. It's more like a repository of commonly used functions. Have something you want to share? post it here!! 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
messageAdd items to <select>
Posted by: panos (IP Logged)
Date: June 23, 2006 03:42AM

This is a function that adds an option element to a select object.

function addStatesOption(val,txt) {
	var oSelect = document.getElementById('select_id');
	var oOption = document.createElement('OPTION');
    if (document.selection) { //IE support
        oSelect.options.add(oOption);
        oOption.innerText = txt;
        oOption.value = val;
    }
    else {
        oOption.text = txt;
        oOption.value = val;
        oSelect.options[oStates.options.length]=oOption;
    }

}

Been tested on IE and Firefox.



Sorry, only registered users may post in this forum.

All Rights Reserved 2006 Salix.gr  |  Design by Ades Design |  Hosting by e-emporio |  forum.Salix.gr powered by Phorum