[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

select list

Posted on 2000-03-01
3
Medium Priority
?
151 Views
Last Modified: 2010-04-09
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
0
Comment
Question by:eladr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
xabi earned 200 total points
ID: 2572180
Hi there:
I'm not sure about what you want to do  but I will try to explain yo a few things:
The option showed by default is the first one of the list if you don't add the word "selected" in any other option.
ie:
<OPTION VALUE="">choose car
<option value="1">honda</option>
<option value="2" selected>peugeot</option>

this will show peugeot by default.
If you want to do it dinamicaly you must use ASP or PHP or any other language that reads from the database and write the word "selected" in the right option field.

If you need more help just ask

xabi
0
 
LVL 8

Expert Comment

by:xabi
ID: 2572188
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
0
 
LVL 1

Author Comment

by:eladr
ID: 2572231
thanx a lot!
i asked that because i will use it
with asp - you are good!
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question