View Full Version : Changing combo box?
landon11
10-04-2002, 03:40 PM
can you make a combo box show one thing and when you open it show some else such as showing "M" but when you click the arrow it says "Married" ?
adios
10-04-2002, 04:29 PM
<html>
<head>
<title>untitled</title>
</head>
<body>
<form>
<select onfocus="selectedIndex=1">
<option selected="selected">M</option>
<option>Married</option>
</select>
</form>
</body>
</html>
JavaScript indexes start with 0.
landon11
10-04-2002, 08:37 PM
Thank you but I don't think that does what I need.
I want the "M" to show but when you click the arrow the "M" is replace by "Married". Then when you select "Married" only the "M" shows.
landon11
10-04-2002, 09:06 PM
I came up with this but it does not work very good
<html>
<head>
<title>untitled</title>
<script>
function DoIt(myEl){
myEl.options[myEl.selectedIndex].innerHTML = "Married";
}
function UnDoIt(myEl){
myEl.options[myEl.selectedIndex].innerHTML = "M";
}
</script>
</head>
<body>
<form>
<SELECT onblur="UnDoIt(this);" onfocus="DoIt(this);")>
<OPTION selected value="M">M</OPTION>
<OPTION value="S">S</OPTION>
</SELECT>
</form>
</body>
</html>
chrismiceli
10-05-2002, 04:23 AM
if you want it to where you hit the letter "m" and it will go to the first option in a drop down box that starts with the letter "m", that is built in, just look at the excite register page, when you highlight the male/female thing, if you hit "m" it will hightlight male but if you hit the "f" key it will hightlight female.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.