Question

Locked

drop down list using java script

By vigneshmarimuthu08 ·
Tags: Software
hi i am new to java. i tried to generate a drop down list. if a select a value from the list and update the page it shows the index value "select". i want to show the selected value in the list. here i have added my code please tell what changes i have to make over here.


<select name="year" id="year<%=gfimCount%>" class="textbox" style="width:60px;" >
<option value="select">Select</option>
<script type="text/javascript">
var YearList = 6; // number of "year" selections.
var year = new Date().getFullYear();
for(var i=5;i>0;i--){
var previousyr=year-i;
document.write('<option value="' previousyr '">' previousyr '</option>');
}
//document.write('<option selected="true" value="' previousyr '">' previousyr '</option>');
for(var i=0;i<YearList;i ){
var currentyr = year i;
document.write('<option value="' currentyr '">' currentyr '</option>'); //document.getElementBbyId(<%="currentyr"%&gt.value;
}
//document.write('<option selected="true" value="' currentyr '">' currentyr '</option>');
</script>
</select>

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums