Posted By

apphp-snippets on 03/05/13


javascript redirect

Versions (?)

Redirect with a Dropdown Menu in JavaScript

 / Published in: JavaScript


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.

  1. <script type="text/javascript">
  2. function do_redirect(site){
  3. window.location.href = site;
  4. }
  5. </script>
  7. <select onchange="do_redirect(this.value)">
  8. <option value="#">What site would you like to see?</option>
  9. <option value="">Google</option>
  10. <option value="">Yahoo</option>
  11. <option value="">ApPHP</option>
  12. </select>

Report this snippet  

You need to login to post a comment.