View Single Post
  #1 (permalink)  
Old 06-21-09, 09:42 PM
smithygotlost smithygotlost is offline
Coding Addict
 
Join Date: Jul 2006
Location: United Kingdom
Posts: 345
Thanks: 7
Thanked 0 Times in 0 Posts
Hotkey On Keypress

Heya Guys

Ive got a scrip that on a given key press uses location.href ='URL' this is great for the way we used to do things, now we made everything java so rather than going to a url i need it to run a javascript function, However after hours of trying i have no idea

i need it to do this

Code:
if (x==key1) location.href='<?echo "charmove($map_link_up,$hex_up)"; ?>';
the full script is below

Code:
<script language="javascript">
var key1="119";
var x='';
function handler(e)
{
  if (document.all) {
  var evnt = window.event;
  x=evnt.keyCode;
}
else
x=e.charCode;
if (x==key1) location.href='<?echo "charmove($map_link_up,$hex_up)"; ?>';
}
if (!document.all){
window.captureEvents(Event.KEYPRESS);
window.onkeypress=handler;
}
else
{
document.onkeypress = handler;
}
 </script>
Any help will be greatly welcomed

Thanks
Mike
__________________
Make People Friendly Say " Thanks "
Reply With Quote