Jump to content

Recommended Posts

wat..?

I currently have:

<div id="scene_input" onkeydown='evtKeyboard.KeyDown(event)' onkeyup="evtKeyboard.KeyUp(event)" onclick='evtMouse.GetMouseState(event)' style="width:100px; height:100px; border:1px solid #ff0000"></div>

None of the onkey events work. However, onclick does... In body, onkey events work just fine. However placing them inside of body is not a possibility for my current project.

 

I don't get what you mean by your post.. Using addEventListener() inside of a javascript script works for exactly what I described in my first post. However it it seems to pause setTimeout and setInterval for some reason.

What you said in your first post made it sound like you didn't want to use any event handlers at all, not that you simply didn't want them on the

.

 

What's the structure of your HTML and where can you make changes?

I'm not sure what you mean by structure. I'm trying to send keypresses to a canvas element.

My html document looks like this:

<!DOCTYPE HTML>
<HTML>

<HEAD>

	<script type="text/javascript" src="scripts/glib.js"></script>
	<script type="text/javascript" src="scripts/glib_common.js"></script>

</HEAD>

<BODY> <!--onload="init()" onkeydown="evtKeyboard.KeyDown(event)" onkeyup="evtKeyboard.KeyUp(event)" onclick="evtMouse.GetMouseState(event)"> -->
	<canvas id="scene" style="border:1px solid #ff0000; width:500px; height:500px;">
		Your browser does not support a Canvas element!
	</canvas>
	<div id="debug" style="position: relative; width:500px;height:200px; border:1px solid #0010ff"></div>

	<script>init();</script>

</BODY>

</HTML>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.