Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the default item in a select list. 1

Status
Not open for further replies.

LeonAtRC

Programmer
Nov 25, 2002
101
US
Here's the code:
Code:
<SELECT NAME="theSplit">
    <OPTION VALUE="Split1">5k</OPTION>
    <OPTION VALUE="Split2">10k</OPTION>
    <OPTION VALUE="Split3">10 Mile</OPTION>
    <OPTION VALUE="theFinish">Finish</OPTION>
</SELECT>
I'm not concerned which item shows when the page is first loaded, although it is always "5k".
But, then I would like the default item to always be the last item that was selected.

Is this possible?
 
Selected from where or when? Do you mean if the page is refreshed?

Lee
 
Sorry, I should have been clear.
The code is in a frameset and the frame doesn't get refreshed.
Only the target frame, where the list appears, changes. So I need to have the drop down list always indicating what option the list is generated from.
If you go here: and click on the "Leader Board" button you'll see what I'm trying to accomplish.
Thanks for you help.
Leon
 
What you want is the inherent behaviour of the select box control. After you select something, that will stay selected unless:
a) you select something else;
b) you refresh the page;

You're doing b) in this line
Code:
parent.SearchWindow.location = "RaceSelector.htm";
of the script in your actual results page. Why you have it there, I don't know, but you should definitely remove it and see how things work the way you want them to.
 
Thanks Vragabond, that works.
I thought I had commented out that line with <!-- --> but apparently it was still being read.
 
The comment you were using is an html comment. It makes parts of html not display. However, when you output a <script> tag, you move out of html into whatever language the type attribute of script refers to. You were inside javascript just then, where single line comments are done with [tt]//[/tt] and multiline comments by [tt]/* comment */[/tt].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top