From 58299271ddd18f32c1bada1e3b704b3bcdc5b357 Mon Sep 17 00:00:00 2001 From: Logfro Date: Fri, 17 Nov 2023 18:41:42 +0100 Subject: [PATCH] Added keydown functionality --- about.html | 7 ++++--- index.html | 1 + js/keyevents.js | 18 ++++++++++++++++++ project.html | 7 ++++--- test.html | 1 + work.html | 3 ++- 6 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 js/keyevents.js diff --git a/about.html b/about.html index f64e173..26d7788 100644 --- a/about.html +++ b/about.html @@ -73,8 +73,9 @@ - - - + + + + \ No newline at end of file diff --git a/index.html b/index.html index f5a380e..0facd2c 100644 --- a/index.html +++ b/index.html @@ -40,5 +40,6 @@ + \ No newline at end of file diff --git a/js/keyevents.js b/js/keyevents.js new file mode 100644 index 0000000..ca6b247 --- /dev/null +++ b/js/keyevents.js @@ -0,0 +1,18 @@ +document.addEventListener("keydown",(event) => { + switch(event.keyCode){ + case 46: //DEL Key + document.location = "about.html"; + event.preventDefault(); + return false; + case 112: //F1 + document.location = "index.html"; + event.preventDefault(); + return false; + case 113: //F2 + document.location = "work.html"; + event.preventDefault(); + return false; + default: + return true; + } +}); \ No newline at end of file diff --git a/project.html b/project.html index 1df2d6e..e4a4732 100644 --- a/project.html +++ b/project.html @@ -113,8 +113,9 @@ - - - + + + + \ No newline at end of file diff --git a/test.html b/test.html index 96fb557..2486655 100644 --- a/test.html +++ b/test.html @@ -27,6 +27,7 @@ + diff --git a/work.html b/work.html index 17cdd96..da2345b 100644 --- a/work.html +++ b/work.html @@ -63,6 +63,7 @@ - + + \ No newline at end of file