Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listening for Function Keys

 
Doug Harding
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm not sure if this is the correct forum for this question. If it isn't, please point me to the correct place.

I have an application that runs in websphere. There is a main webpage with frames. It uses functions in a java class file.

I need to set this app up so that it will listen for function keys. Specifically I need to capture F1 and point it to the app help instead of IE's help. I also want to be able to capture other Fkeys and have them perform other functions that are available in the main page by clicking on controls.

The issue that I'm having trouble with is how to register the listener. I don't have a control to register it to. I want the app to do the listening and act appropriately.

I would appreciate any help that can be offered.

Thanks,

Doug Harding
State of Utah / Division of Finance
 
Maki Jav
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doug Harding hailing from State of Utah what you need here is
some Javascript to capture keys;also if required, you might make functions in your Java class and call those functions on Key event in Javascript


Example:


Here is the applet class

TestJREApplet extends Applet{

public static String jreExits(){

return "Found JRE";

}
}

Here in your web page you will have two things 1) Applet tag 2)Javascript


<Applet code="TestJREApplet" name="myApplet" height=1 width=1></Applet>


<Script>

function checkJRE(){

if(myApplet){

alert(myApplet.jreExits());
}

else {

// Applet not loaded, most probably no JRE installed on turned on

// do some work

}

}

</Script>


you might google for more on calling Applet from Javascript, and for key code, keyevents etc in JavaScript.

There is a difference in Netscape and IE regarding Javascript but many javascript code snippets work in both.

Thanks,

Maki Jav
[ December 06, 2006: Message edited by: Maki Jav ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic