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?

14 of 40 people (35%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

how to set the selected item in html select form , i want to set the current month selected in selec

Apr 7th, 2008 23:53
ha mo, Abolfazl Shirazi, irfan mughal,


Abolfazl Shirazi:
It is really easy and simple. Just try it:
<html>
<head>
<script language="javascript">
function SelectBest() {
	MyDate = new Date() ;
	MonthList.selectedIndex = MyDate.getMonth() ;
}
</script>
</head>
<body onload="SelectBest()">
<select name="MonthList">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
</body>
</html>
Good Luck!
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