Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save apphp-snippets/4753279 to your computer and use it in GitHub Desktop.

Select an option

Save apphp-snippets/4753279 to your computer and use it in GitHub Desktop.
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.
<script type="text/javascript">
function do_redirect(site){
window.location.href = site;
}
</script>
<select onchange="do_redirect(this.value)">
<option value="#">What site would you like to see?</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.yahoo.com">Yahoo</option>
<option value="http://www.apphp.com">ApPHP</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment