Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. keboard commands

keboard commands

Scheduled Pinned Locked Moved Web Development
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kelly Smith
    wrote on last edited by
    #1

    I need to be able to open my web site using a keyboard command. Does anyone have any idea how to code that? :confused:

    J 1 Reply Last reply
    0
    • K Kelly Smith

      I need to be able to open my web site using a keyboard command. Does anyone have any idea how to code that? :confused:

      J Offline
      J Offline
      Jonavis
      wrote on last edited by
      #2

      Hey... what I can help you with is a little Javascript that executes a specific comandad after a certain string of letters or keys are pressed in the correct order on your keyboard. Place this in the of your file(s) and substitute "word" in the SpecialWord variable for any string of characters that you wish to use. The SpecialUrl can be any page where you would like to be redirected after typing your secret word. SO here it goes.. var SpecialWord = "word",SpecialUrl = "http://www.yoursite.com/secrete_server/",SpecialLetter = 0; function getKey(keyStroke) { var isNetscape=(document.layers); // Cross-browser key capture routine couresty var eventChooser = (isNetscape) ? keyStroke.which : event.keyCode; var which = String.fromCharCode(eventChooser).toLowerCase(); if (which == SpecialWord.charAt(SpecialLetter)) { SpecialLetter++; if (SpecialLetter == SpecialWord.length) window.location = SpecialUrl; } else SpecialLetter = 0; } document.onkeypress = getKey; with a small modification you could execute a specific JScript, VBScript..or pretty much anything else.. hope that works... luck.. Jon X-ZD Designs

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups