Web Analytics Made Easy -
StatCounter script for defining selected option - CodingForum


No announcement yet.

script for defining selected option

  • Filter
  • Time
  • Show
Clear All
new posts

  • script for defining selected option

    I am posting again this thread, because i think this is a more appropriate forun than the one i used before. Sorry for the mistake.

    I have a drop down menu created with a select tag and i have the following values in it:
    1. "All", for selecting alltogether the values (for query purposes)
    2. The rest of the values which come with a query from a database.

    Each time I enter the page I want to have selected as a first option, the previous selection and if there is no previous selection (firts time into the page or never used the menu before), I want pre-selected the "All" option.
    The code up to now -without using the "selected" attribute- looks like this:

    <form action="###" method="post">
    <option value="0">All</option>
    <c:forEach var="row" intems=.......>
    <option value="row.value">row.name</option>

    I am close to the answer with a script, but i am not at all good using them!

    I would appreciate any help.