MareoRaft 0 Junior Poster in Training

Hi! I am looking for a solution to use the onKeyPress() event in Safari or Chrome. It seems very tricky, because each browser behaves differently. This is what I have so far...

...
<script type = 'text/javascript'>
function turn(e){
	alert('turn!');
}
</script>
<body onKeyPress='turn(event)'>
</body>
...

I also want to check the value of the key pressed. If the value is 37, for example, I will execute certain code. If not, I don't want it to do anything.

Thanks!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.