Saturday, 15 January 2011

javascript for loop to decrease -



javascript for loop to decrease -

i have jquery loop

for (; year <= endyear; year++) { html += '<option value="' + year + '"' + (year == drawyear ? ' selected="selected"' : '') + '>' + year + '</option>'; }

year = 1950 , endyear = 2006.

my alternative values appear so

1950 1951 1952 , on

i trying reverse

2006 2005 2004 , on

how reverse statement for (; year <= endyear; year++) {

reverse loop goes in opposite direction!

var startyear = 1950; var endyear = 2006; (var year = endyear; year >= startyear; year--) { html += '<option value="' + year + '"' + (year == drawyear ? ' selected="selected"' : "") + ">" + year + "</option>" }

javascript for-loop operators

No comments:

Post a Comment