wright67uk 0 Newbie Poster

Ive been playing around with a couple of scripts both of which work well on their own. The first is a basic alertbox that uses a hotkey;

<script>
$(document).jkey('o', function(){ alert('Pressed o');});
</script>

The second is a custom alert box which displays after clicking on a link.
How can I incorporate the jkey function from the first script to trigger the alert box in the second script?

ie. I want to trigger the custom alert box by pressing 'O'

<html>
<style type="text/css">
.alert {
   display:none;
   position:absolute;
   top:1px;
   left:1px;
   width:300px;
   background-color:white;
   border-style:solid;
   border-width:1px;
   padding:15px 20px 5px 20px;
   }
   </style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jkey-1.2[1].js"></script>
</head>
<body>

<style type="text/css">

</style>

<div id="AlertBox" class="alert">
<p>
Hi! This is a test.
</p>
<p>
It is only a test. If this had been the real thing, then this would not be a test.
</p>
<form style="text-align:right">
<input 
   type="button" 
   value="OK" 
   style="width:75px;" 
   accesskey="w"
   onclick="document.getElementById('AlertBox').style.display='none'">
</form>
</div>

<script type="text/javascript"><!--
function DisplayAlert(id,left,top) {
document.getElementById(id).style.left=left+'px';
document.getElementById(id).style.top=top+'px';
document.getElementById(id).style.display='block';
}
//--></script>

<script type="text/javascript"><!--
function DoSomething() {
var something = false;
if(something) {
   // do this section
   }
else {
   DisplayAlert('AlertBox',100,50);
   }
}
//--></script>

<p>
<a href="javascript:DoSomething()">
Click here</a> 
to demonstrate the alert box alternative.
</p>

</body>
</html>