from and back button

  • Thread starter mantas.vitkunas
  • Start date
M

mantas.vitkunas

I've written a web page in which a <select> element uses the
"onchange" attribute to advance to another page instead of requiring
the user to pick an option from the select menu and then click a
"submit" button.

One problem with this, however, is that if the user clicks their back
button after using the <select> menu, the previously selected value
remains in place.
 
B

BootNic

news: (e-mail address removed)
I've written a web page in which a <select> element uses the
"onchange" attribute to advance to another page instead of requiring
the user to pick an option from the select menu and then click a
"submit" button.

One problem with this, however, is that if the user clicks their back
button after using the <select> menu, the previously selected value
remains in place.

Set the selectedIndex before you jump.

Object.selectedIndex=0;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<select onchange="var a=this.options[this.selectedIndex].value;
this.selectedIndex=0;
window.location=a;">
<option selected="selected">Select</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.yahoo.com">Yahoo</option>
</select>
</body>
</html>
--
BootNic Thursday, April 05, 2007 12:10 AM

All things come to him who waits - provided he knows what he is
waiting for.
*Woodrow T. Wilson*
 
J

Jukka K. Korpela

Scripsit (e-mail address removed):
I've written a web page in which a <select> element uses the
"onchange" attribute to advance to another page instead of requiring
the user to pick an option from the select menu and then click a
"submit" button.

And then you leave users with JavaScript disabled exactly where? Note that
this includes indexing robots.
One problem with this, however, is that if the user clicks their back
button after using the <select> menu, the previously selected value
remains in place.

The real problem is that you are using an expensive poorly working plastic
imitation of a list of links. Use links, Luke. For a list of reasons, check
http://www.cs.tut.fi/~jkorpela/forms/navmenu.html#ben
 
S

scripts.contact

I've written a web page in which a <select> element uses the
"onchange" attribute to advance to another page instead of requiring
the user to pick an option from the select menu and then click a
"submit" button.
One problem with this, however, is that if the user clicks their back
button after using the <select> menu, the previously selected value
remains in place.

# Set the selection back to default before you change the location of
page.

or

# Set the selection to default on page load.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top