PDA

View Full Version : Javascript Keyword Help



skilled1
04-24-2006, 04:22 PM
I got the code from the main page, and now i can not find the link to it, however here is the code.



<!--- begin keyword --->
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var SpecialWord = "adminupload",
SpecialUrl = "documents/upload.cfm",
SpecialLetter = 0;
function getKey(keyStroke) {
var isNetscape=(document.layers);

var eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
var which = String.fromCharCode(eventChooser).toLowerCase();
if (which == SpecialWord.charAt(SpecialLetter)) {
SpecialLetter++;
if (SpecialLetter == SpecialWord.length) gotoUrl(SpecialUrl);
}
else SpecialLetter = 0;
}
document.onkeypress = getKey;
function gotoUrl(Url) {
document.cookie = "admin=1";
window.location = Url;
//alert ('document.cookie');
}

// End -->
</script>
<!---end keyword --->


problem is i need it to work with two diferent keywords now. the first works great, just need to add a second, and i am having difficultly in doing so.