Little Goat Posted April 7, 2006 Share Posted April 7, 2006 ok, ive seen some <select> dropdown menus hav it so that if you try to select one option, it wont let you. (such as the jump menu on this site)anyone know how to do this?thnx, LG Link to comment Share on other sites More sharing options...
raimo Posted April 7, 2006 Share Posted April 7, 2006 ok, ive seen some <select> dropdown menus hav it so that if you try to select one option, it wont let you. (such as the jump menu on this site)anyone know how to do this?thnx, LG<{POST_SNAPBACK}> Something like this?<script type="text/javascript"><!--function check(menu){if (menu.selectedIndex == 2) alert('Nope!')else alert('OK!');menu.selectedIndex = 0; //reset selection}//--></script><select onchange="check(this)"><option value="-">-</option><option value="1">1</option><option id="se2"value="2">2</option><option value="3">3</option><option value="4">4</option></select> edit: added id se2 to get this work:document.getElementById('se2').disabled = 'disabled';to get element back to enabled:document.getElementById('se2').disabled = '';seems disabled is not working with MSIE? all real browsers it works ok. Link to comment Share on other sites More sharing options...
aspnetguy Posted April 7, 2006 Share Posted April 7, 2006 using obj.disabled = true;or obj.disabled = false;works in all browsers Link to comment Share on other sites More sharing options...
Little Goat Posted April 7, 2006 Author Share Posted April 7, 2006 ok, hey thanks alot guys!LG Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now