function changeSelect(optiontext, optionvalue) { // find out how many items are already in the select box var selectLength = document.formname.selectname.options.length;
// add new item document.formname.selectname.options[selectLength] = new Option(optiontext, optionvalue); } <a href="" onClick="changeSelect('text 1', 1); return true">add option 1</a> <a href="" onClick="changeSelect('text 2', 2); return true">add option 2</a> <a href="" onClick="changeSelect('text 3', 3); return true">add option 3</a> should do it. Duncan Cumming IT Manager http://www.alienationdesign.co.uk mailto:[EMAIL PROTECTED] Tel: 0141 575 9700 Fax: 0141 575 9600 Creative solutions in a technical world ---------------------------------------------------------------------- Get your domain names online from: http://www.alienationdomains.co.uk Reseller options available! ---------------------------------------------------------------------- ---------------------------------------------------------------------- "Peter Dray" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> c.com> cc: Subject: [ cf-dev ] OT: javascript help needed 03/04/2003 10:12 Please respond to dev Can anyone tell a javascript moron how to do this: I have a multiple select box that starts empty. I need an onClick event that adds an option to the select box (the user will be clicking on a text link) up to a maximum of three options. All help much needed and gratefully accepted. Pete -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]