By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Cross browser event issues

P: n/a
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 <canvascommunity 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>
Oct 24 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Bug in code. Name of click handler in canvas should be "click_", not
just "click".
Oct 24 '08 #2

P: n/a
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.
Oct 26 '08 #3

P: n/a
Ma************@gmail.com wrote:
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 <canvascommunity would be
appreciated.
--------------------------------------
<! t.html - test event handling>
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

--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
Oct 27 '08 #4

P: n/a
Ma************@gmail.com wrote:
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 <canvascommunity would be
appreciated.
--------------------------------------
<! t.html - test event handling>
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

--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
Oct 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.