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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing the select option

Status
Not open for further replies.

FALCONSEYE

Programmer
Jul 30, 2004
1,158
US
When a user uses go back button on the browser, my select does not default back to its original state. So far I have:

Code:
...
function clearState() {
		document.getElementById("st").options[document.getElementById("st").selectedIndex].value = "";
		}
...

<body onload="clearState();">

any help?



 
What do you mean its "orginal state"? Do you mean go to the first select option in the list every time the back button is pressed?
 
Try this...
Code:
var dropdown = document.getElementById("st");
dropdown.selectedindex = 0;
dropdown.options[0].selected = true;

I think that may work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top