mkefeli Posted August 19, 2008 Share Posted August 19, 2008 In the codes below, always July comes selected. But I want month(Year) selected. Or, for example; ay=4 then April selected. Can anyone help me? Thenks.----------<select name="ay"> <option value="1"> JAN </option> <option value="2"> FEB </option> <option value="3"> MAR </option> <option value="4"> APR </option> <option value="5"> MAY </option> <option value="6"> JUN </option> <option value="7"selected="selected"> JLY </option> <option value="8"> AUG </option> <option value="9"> SEP </option> <option value="10"> OCT</option> <option value="11"> NOW </option> <option value="12"> DEC </option></select> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 19, 2008 Share Posted August 19, 2008 http://devguru.com/technologies/javascript/10594.asphttp://devguru.com/technologies/vbscript/13953.asp Link to comment Share on other sites More sharing options...
mkefeli Posted August 19, 2008 Author Share Posted August 19, 2008 Thanks for reply. But my problem is not about Date function. It is about "selected".If ay=4 then April must be selected, or ay= 12 December must be selected.I hope it is clear. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 19, 2008 Share Posted August 19, 2008 Right. So you use the date functions to figure out what the current month is, and write the selected attribute to the appropriate tag. You use response.write in ASP to write something to the browser. So each of those tags needs an if statement to check if that is the current month and write the selected attribute if it is. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.