Return to Snippet

Revision: 62666
at March 5, 2013 20:11 by apphp-snippets

Initial Code
<script type="text/javascript">
function do_redirect(site){
   window.location.href = site;
<select onchange="do_redirect(this.value)">
   <option value="#">What site would you like to see?</option>
   <option value="">Google</option>
   <option value="">Yahoo</option>
   <option value="">ApPHP</option>

Initial URL

Initial Description
This simple scripts show a possibility to call a JavaScript function that retrieves a variable passed from drop down box as a parameter and then the JavaScript redirects the browser to the variable that was passed to it.

Initial Title
Redirect with a Dropdown Menu in JavaScript

Initial Tags
javascript, redirect

Initial Language