javascript-events

looking for a more comprehensive Javascript onload event

I am developing a script to avoid Flashes Of Un-styled Content by hiding the body element until its contents have fully loaded. This is designed as a plugin for pages rich in disparate and often weighty resources that gradually populate the page, make DOM manipulations etc, leaving the user with a page that is displayed before it is fin...

javascript onclick event handlers not functioning properly

For some reason, my onclick javascript event handlers are not functioning properly. Here is my markup, script and style: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Quadratic Root Finder</title> <script> document.ready = function() { document.getElementById('calculate')....

Why doesn't keypress handle the delete key and the backspace key

I'm not asking this because I need a work-a-around. I have one that works fine, but I want to know WHY it doesn't. Is this bug in javascript (or JQuery because I was using the JQuery .keypress handler) or is there a specific reason why this is so? Thanks in advance. ...

making jQuery code static for different pages

Hello, I am trying to use the jQuery Countown plugin to let my users now how much time they have left for a certain task. So I use the following code to start the countdown with 30 minutes. <script type="text/javascript"> $(function () { $('#defaultCountdown').countdown({until: '+30m'}); }); </script> The problem is that the users ...

jQuery 'event not defined' error on simulated key press

Hi, I am currently trying to use jquery to enter a selection from a dropdown into a text box, simulate a click to select it, press return, wait for some processing and then press return again. It's quite a nasty way of getting what I need but it's the only way I can see at the moment. Here is the code: $('#fav').change(function() {...

Javascript event propagation with image map

Hi, I'm making an image map of the world map where moving the mouse over different parts of the world should highlight that part of the world. I do this by loading images of the different regions into an (initially) empty 'div' and positioning them on top of the world map with css and absolute positioning. It works well except that th...

What happened to the "<script defer>" hack in JQuery?

A few years ago Dean Edwards brought us this workaround to the document.onload problem. The IE version of the solution involved appending this snippet to the document: <script defer src=ie_onload.js><\/script>; Dean was also pretty adamant on the fact that this was the closest solution to perfection he could find and dismissed any sol...

.ready() triggered after window.beforeunload

We have a few places where we include inline <script> blocks which run code, wrapped by $(document).ready(). Several of these blocks use methods dependent on other external scripts. During normal page execution this technique works fine, but when the user navigates away from the page before it's completely loaded, the $(document).ready()...

Get target event with same z-index

Hello I have some divs on the page with different sizes, but with same coordinates and same z-index. How I can get the clicked elements diferently? ...

How to find out the actual event.target of touchmove javascript event?

I am trying to develop a simple drag/drop UI in my web application. An item can be dragged by a mouse or a finger and then can be dropped into one of several drop zones. When an item is dragged over a drop zone (but not yet released), that zone is highlighted, marking safe landing location. That works perfectly fine with mouse events, bu...

disable a link in IE9 - prototype stop() not working

IE9 is still in Beta, but all the same, here is a question: Using prototype.js 1.6.1, proper form for adding a click event to a link, and override the default link behavior, would be: mylink.observe('click', function(e){ doSomething(); e.stop(); }); While this works perfectly in every other browser that I tried, IE9 is a unique...

javascript - How do I make onclick"window.location" also work when user opens in new window

To hide the true destination of a link I'm using the following code: <a href="http://example.com" onclick="window.location='http://url-i-want-to-hide.com/'; return false;">Click me</a> However, if I do right-click and then open in new window, it goes to the url specified in the anchor href tag. I want it to go to the url specified in ...

DOM ready callback

I ran into an interesting issue today. I have canvas elements that I am storing in a 'template'. I clone this template then append it to my document. This works fine, except that I need to draw the canvas manually after they have been appended to the DOM, if I do this in the template they are no longer cloneable and jQuery seems to lo...

javaScript for ADF Faces 1.1 within a loop.

Hi, I am having issue with my js function within a ADF Faces af:interator. I have 3 controls within an af:iterator (af:ouputText, af:inputText, af:selectBooleanCheckBox) and I would like to have a js function on the checkbox so that when checking the checkbox, the text of the ouputText will be copied into the inputText. The issue here i...

Can I set an onChange event using CSS?

I want to have all input elements on my page trigger a function when they change. Can I do it from a CSS? I tried this: <STYLE type="text/css"> input {onChange: function() {alert("foo");};} </STYLE> It didn't work in Google Chrome. ...

iPhone Cache Manifest Problem

Hi, I've been trying to setup a cache manifest for an iPhone WEB Application. I have included: <html manifest="speed.manifest"> However, something isn't working. I have configured easyPhp to deliver manifest with the mime.types file and also added AddType text/cache-manifest .manifest to the httpd.conf to try this also. It unfortunate...

iOS4 Media Control Javascript Events?

I'm not sure if this is exactly what I'm looking for, but I've noticed the iOS4 media controls (double tap home button and slide left to see them) have some control over the HTML5 Audio elements, but is there any way to do a callback for previous and next songs? if so does anyone know the way I can tap into these callbacks? :) Thanks ...

Ask element for their events

In javascript, is there a way yo as a element for the events that i can use to add listener. Something like: element = document.getElementById(id); console.log(element.listEvents); Im using a DOM example, but this would be usefull in node.js also. ...

How is document.createEvent supposed to work with key events?

I'am trying to simulate keypresses in a web application, it is for an embedded system but it uses a Webkit derived browser. I have tested the code in Chrome and get the same error. I tried to use code snippets from this example from Yahoo, but I keep getting the same error when firing the event using dispatchEvent. "target" is an HTML e...

Fb.ui only shows up after second click.

Hi, I am creating a Facebook application which should allow the user do post something on his/her wall. The main actions take place within a Flash movie. When the user is finished the Flash movie uses ExternalConnection to notify the JavaScript. The JavaScript now display a link, that has been hidden all the time and attach a onClick ev...