Link to home
Start Free TrialLog in
Avatar of eladr
eladr

asked on

select list

hi...
this is my simple select list:

<html>
<body>
<form>
<select name="cars">
<OPTION SELECTED VALUE="">choose car
<option value="1">honda</option>
<option value="2">peugeot</option>
</select>
</body>
</html>


my quetion: is there any option that if a user going to enter the page,
he will see one of the items and not the "choose car"?
i mean...in text filed i have the value that let me insert any string i want.
is there any way to do it in select list?
i want him to show him for example the "peugeot" option...
(that's call dynamic select list)
elad
ASKER CERTIFIED SOLUTION
Avatar of xabi
xabi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xabi
xabi

You can also change the selected option using javascript.
ie:

..
..
<script language="javascript">
<!--
function init() {
  document.myform.cars.selectedIndex = 2
}
//-->
</script>
</head>
<body onload="init()">
..
..
<form name="myform">
 <select name="cars">
  <option selected value="">choose car</option>
  <option value="1">honda</option>
  <option value="2">peugeot</option>
 </select>
</form>
..
..

This example will select the 3th (0,1,2) option after the page was loaded.

xabi
Avatar of eladr

ASKER

thanx a lot!
i asked that because i will use it
with asp - you are good!