watagal Posted May 22, 2008 Share Posted May 22, 2008 Greetings-I have a <select name="abc" "onclick='java script:sample()'"> group. I can get the javascript to execute when anything is clicked in the listbox, But i need to further refine the javascript depending on which option is selected (clicked) in the listbox.How can I do this in HTML or in the javascript? This happens prior to hitting the 'submit' form button.TiA, Gal Link to comment Share on other sites More sharing options...
aspnetguy Posted May 22, 2008 Share Posted May 22, 2008 try thisHTML <select name="abc" onchange="sample(this)">...</select> JavaScript function sample(select) { if(select.options[select.selectedIndex].value == "something") { //do someting } else { //do something else }} Link to comment Share on other sites More sharing options...
watagal Posted May 22, 2008 Author Share Posted May 22, 2008 Thanks! That worked like a charm.Gal Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.