Skip to content
Advertisement

Tag: events

JavaScript add events cross-browser function implementation: use attachEvent/addEventListener vs inline events

In order to add events we could use this simple first solution: or this second solution (that adds inline events): These are both cross-browsers and can be used in this way: Since I have the feeling attachEvent/addEventListener are used more around in events handling implementations, I’m wondering: Are there any disadvantages/drawbacks against using the second solution that I might better

Remove key press delay in Javascript

I have the following problem: I’m trying to write a Javascript game, and the character is being controlled by the arrow keys. The problem is, when one keeps the key pressed, there is a short delay between firing the first keypress and the repeated keypress. Also, when one presses the “right arrow key” and keeps it pressed, and then presses

Catch browser’s “zoom” event in JavaScript

Is it possible to detect, using JavaScript, when the user changes the zoom in a page? I simply want to catch a “zoom” event and respond to it (similar to window.onresize event). Thanks. Answer There’s no way to actively detect if there’s a zoom. I found a good entry here on how you can attempt to implement it. I’ve found

Detecting when Iframe content has loaded (Cross browser)

I’m trying to detect when an iframe and its content have loaded but not having much luck. My application takes some input in text fields in the parent window and updates the iframe to provide a ‘live preview’ I started with the following code (YUI) to detect when the iframe load event occurs. ‘preview-pane’ is the ID of my iframe

Advertisement