http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - Capturing Hotkeys</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('./dynapisrc/');
dynapi.library.include('dynapi.library');
dynapi.library.include('dynapi.api');
dynapi.library.include('dynapi.api.ext.DynKeyEvent');
dynapi.library.include('dynapi.functions.Color');
</script>
<script language="Javascript">
dynapi.document.captureHotKey('ctrl+z',fn);
dynapi.document.captureHotKey('alt+x',fn1);
dynapi.document.showScrollBars(true)
function fn(){
alert("Hello you've pressed Ctrl+Z")
};
function fn1(){
dynapi.document.setBgColor(dynapi.functions.getRandomColor());
};
</script>
</head>
<body>
Press ctrl+z to display a message<br>
Press atl+x to change the document background color
<p>Note: NS4 does not support the "alt" key nor the combination of more than one keys (e.g. ctrl+z)</p>
</body>
</html>
|