?
Solved

select list

Posted on 2000-03-01
3
Medium Priority
?
150 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 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