Snippets v2

Languages
My Snippets

Jump to a location depending on a question Login or Register to Bookmark this snippet

Description Javascript

This function will go to one of two locations depending on the Yes or No answer supplied. If a location is an empty string, it assumes the question is cancelled and does nothing.

The Code Download
  1. function AskQuestion(question,onyes,onno) {
  2.     var where_to = confirm(question);
  3.     if (where_to == true) {
  4.         if (onyes && onyes != "") {
  5.             window.location=onyes;
  6.         }
  7.     } else {
  8.         if (onno && onno != "") {
  9.             window.location=onno;
  10.         }
  11.     }
  12. }
Credits Contact JC

Added by JC on 11th November, 2007

Comments

There are no comments about this snippet.

Post Comment HTML is allowed

You must be registered and logged in to post a comment.

Login here to post a comment