Cross browser event issues

M

MartinRinehart

In my next post I'll submit an Opera-only, canvas-based widget. My
intent is to write code that runs in Chrome, Firefox, Opera and
Safari. Below is a tiny tester for the events I want to handle. Any
help getting this to support the <canvas> community would be
appreciated.
--------------------------------------
<! t.html - test event handling>

<html>
<head>
<script>
function click_() { alert( 'click' ); }
function keyPress() { alert( 'keyPress' ); }
function wheel() { alert( 'wheel' ); }
</script>
<style>
table {
position:absolute; top:10px; left:10px;
background: red;
}
.label {
position:absolute; top:80px; left:10px;
}
canvas {
position:absolute; top:100px; left:10px;
background:blue;
}
</style>
</head>
<body>
<button style='font-size:18px; background:yellow'
onclick=click_() onkeypress=keyPress() onmousewheel=wheel()>
button
</button>
<div class=label>Canvas:</div>
<canvas height=50 width=100
onclick=click() onkeypress=keyPress() onmousewheel=wheel()>
no canvas
</canvas>
</body>
</html>

<! end of t.html>
 
M

MartinRinehart

Bug in code. Name of click handler in canvas should be "click_", not
just "click".
 
M

Martin Rinehart

WARRNING! PPK's dropdown widget Krashed Konqueror. Scroll or search
instead.

Seems we're still on the bleeding edge, here:

http://www.quirksmode.org/dom/events/index.html

Worse, above table is one dimension short. What works depends on what
it's attached to. Firefox fires keydown on a button, but not on a
canvas.

Worst, the w3c documentation makes the implicit assumption that the
JavaScript widget set is sufficiently complete that no one would be
adding their own.
 
D

dhtml

In my next post I'll submit an Opera-only, canvas-based widget. My
intent is to write code that runs in Chrome, Firefox, Opera and
Safari. Below is a tiny tester for the events I want to handle. Any
help getting this to support the <canvas> community would be
appreciated.

Posts with valid HTML tend to get much better responses here.
http://jibbering.com/faq/#postCode

You can't really expect anything from such invalid code.

Garrett
 
D

dhtml

In my next post I'll submit an Opera-only, canvas-based widget. My
intent is to write code that runs in Chrome, Firefox, Opera and
Safari. Below is a tiny tester for the events I want to handle. Any
help getting this to support the <canvas> community would be
appreciated.

Posts with valid HTML tend to get much better responses here.
http://jibbering.com/faq/#postCode

You can't really expect invalid code like that to do what you want it to.

Garrett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top