/    Sign up×
Community /Pin to ProfileBookmark

Disable Function Keys and make them navigate

I have not had much luck with this and this is my first post. I want to make F1-F12 naviagte to webpages I determine, disabling there normal use. This is for an intranet training application that will be used by a small group. Losing the original function is not a big deal. Here is an example of what I found, but it is for A-Z and I need F1-F12.

<Html>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>

<!– Begin
var key = new Array(); // Define key launcher pages here
key[‘h’] = “http://www.yahoo.com“;
key[‘f’] = “http://www.msn.com“;
key[‘n’] = “http://www.google.com“;
key[‘s’] = “http://www.nfl.com“;

function getKey(keyStroke) {
isNetscape=(document.layers);
// Cross-browser key capture routine couresty
// of Randy Bennett ([email protected])
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
which = String.fromCharCode(eventChooser).toLowerCase();
for (var i in key) if (which == i) window.location = key[i];
}
document.onkeypress = getKey;
// End –>
</script>
</HEAD>
<body>
<table border=0>
<tr>
<td> Press ‘h’ for: Yahoo!<br>
<br>
Press ‘f’ for: MSN<br>
<br>
Press ‘n’ for: Google<br>
<br>
Press ‘s’ for: NFL<br>
<br>
</td>
</tr>
</table>
</html>

Thanks
Eric

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@7studFeb 14.2005 — I want to make F1-F12 naviagte to webpages I determine, disabling there normal use.[/QUOTE]
www.google.com
Copy linkTweet thisAlerts:
@echristo66authorFeb 14.2005 — ???

can you help me?
Copy linkTweet thisAlerts:
@decibelFeb 14.2005 — i cant help, but i do want to comment that i think you question is great for discussion in THIS FORUM.
Copy linkTweet thisAlerts:
@echristo66authorFeb 14.2005 — There has got to be a way!!! I just don’t know how to write it. There is not much of a practical use so there is not much on the web about this.

I have extreme tired head!
Copy linkTweet thisAlerts:
@A1ien51Feb 15.2005 — You are not going to be able to do it. Reason, you can fire an event when it is clicked, but the browser will also do its default behavior. There is no way around this.

I would not recommend you even try since people do not like things to change. aka, disabling right click, cntrl, alt, keys, etc.

You should look into meta key combinations if you want to do this. You can search google for [b]meta key JavaScript combination[/b] and you should find scripts.

If you search your question on google, you normally find your answer quicker. That is what that hint above was.

Remember, calm down, people are helping for free here.

Eric
×

Success!

Help @echristo66 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...