Created
February 11, 2013 20:14
-
-
Save chrisle/4757219 to your computer and use it in GitHub Desktop.
Nicos bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is to be used as a bookmarklet | |
// Supposed to show a prompt where you pick if you want to do a site: search alpha using 'a' or bravo using 'b' | |
// However, this isn't working as a bookmarklet but does work in the live w3 editor | |
javascript:var name=prompt("Please enter your name \n a = alpha \n b = bravo","x"); | |
switch (name) { | |
case "a": | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" alpha" | |
break; | |
case "b": | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" bravo" | |
break; | |
default: | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" "; | |
} | |
// Fixed. You forgot semicolons at the end of the statements. If you checked the inspector window, you would have seen that as an error. | |
javascript:var name=prompt("Please enter your name \n a = alpha \n b = bravo","x"); | |
switch (name) { | |
case "a": | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" alpha"; | |
break; | |
case "b": | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" bravo"; | |
break; | |
default: | |
location.href='http://www.google.com/search?q=site%3A'+document.domain.replace('www.','')+" "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment