Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Capture multiple Key Press ctrl+p?

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In My Intranet Application ,

I'm change the controls for media player, where i'm using the

combination like ctrl+p,ctrl+m and etc.

<script type="text/javascript">

function displayKeyCode(evt)
{
var textBox = getObject('txtChar');
var charCode = (evt.which) ? evt.which : event.keyCode
textBox.value = String.fromCharCode(charCode);
if (charCode == 18){
textBox.value = "Alt"; // F4
alert("You Pressed Alt");
}
if (charCode == 17 && charCode == 80)
{
textBox.value = "Ctrl+P"; // F7
alert("You Pressed Ctrl+P");
}
if (charCode == 17 && charCode == 79)
{
textBox.value = "Ctrl+O"; // F7
alert("You Pressed Ctrl+O");
}

if (charCode == 17 && charCode == 78)
{
textBox.value = "Ctrl+N"; // F7
alert("You Pressed Ctrl+N");
}

if (charCode == 17 && charCode == 77)
{
textBox.value = "Ctrl+M"; // F7
alert("You Pressed Ctrl+M");
}
var lblCharCode = getObject('spnCode');
lblCharCode.innerHTML = 'KeyCode: ' + charCode;
return false;
}
function getObject(obj)
{
var theObj;
if (document.all) {
if (typeof obj=='string') {
return document.all(obj);
} else {
return obj.style;
}
}
if (document.getElementById) {
if (typeof obj=='string') {
return document.getElementById(obj);
} else {
return obj.style;
}
}
return null;
}

</SCRIPT>


I used the above script to capture the keypress events but it is working for
only one Like (any Key), If clicked multiple keys but it is not captuing ,

i think some problem with my code,

please help me..
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to look into modifier key

Also be careful or you wll have people printing out your page!

Eric
 
chsanthosh kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution,

Here is the Code

Thank You For helping Me.
Eric
[ December 27, 2006: Message edited by: chsanthosh kumar ]
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic