| Posted by BootNic on 04/05/07 04:10 
> mantas.vitkunas@gmail.com <mantas.vitkunas@gmail.com> wrote:> news: 1175739988.305644.322740@e65g2000hsc.googlegroups.com
 > 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*
 [Back to original message] |