faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 13 people (46%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Select list on html visible through the popup menu

Apr 8th, 2008 19:23
ha mo, Abolfazl Shirazi, kris batt,


Abolfazl Shirazi:
Selecting a list item from a popup menu is quite easy. It is very 
clear. You should set (popupmenu.selectedIndex) to a numeric value in 
order to select it's item.
Just try it!
<!-- Begin -->
<html>
<body>
<form name="myform">
<select name="mylist" size="1">
<option>choice1 text</option>
<option>choice2 text</option>
<option>choice3 text</option>
</select>
</form>
<br>
<button onclick="document.myform.mylist.selectedIndex=0">select item 
1</button>
<button onclick="document.myform.mylist.selectedIndex=1">select item 
2</button>
<button onclick="document.myform.mylist.selectedIndex=2">select item 
3</button>
</body>
</html>
<!-- End -->
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com