Skip to content
Advertisement

Tag: dom-events

Why JavaScript IF only works once?

I have JavaScript code which copies the value of input file and paste it in the text box in real time. Sadly this only works once and then stops pasting the value when changing the file again. (I mean you should reload the page to make it work again) Does IF have a cache or something? You can try the

What’s wrong with addlistener… how do I fire my event

I am using the following functions to do my task. It works fine when cursor moves away from the textbox but if I want to fire the same event from code say like next function I get an error… Answer Adapting the code given as a jQuery extension in this answer, here’s a function you can use to programmatically fire

Check if ‘onload’ would have fired already?

I have a situation where I’d like to set an onload handler for a script element, but it is possible that the script element has already loaded before I do so. If it’s already loaded, I’d like to detect that and run my handler immediately. What would be a reliable way of checking a script element’s onload state after the

click() method in Firefox

The following code is throwing two alerts as expected in IE but not in Firefox. Please help. Answer Firefox only has a click() function for form elements such as buttons. However, you can call the onClick function directly; you can change the line to This works in firefox or IE (but note that it requires that the function actually exists,

Changing window.location.href in Firefox in response to an onunload event

I have a strange JavaScript problem using window.location.href, which apparently only affects Firefox (I’m using 3.6). Normally window.location.href would not be read-only, and this works perfectly in Firefox: However, when I call a function in response to an onunload event (<body onunload=”testThis();”>), this doesn’t work as expected: In both cases, the alert displays the current location of the page in

Mouse event weirdness

Here is the Greasemonkey script I’m working on (source below): http://userscripts.org/scripts/show/69722 You can test it out on this page: http://forums.whirlpool.net.au/forum/35 Hover over a thread title and a div appears with a preview. The weird thing is, when you move your mouse around on the div, the mouseout event is getting fired for some reason. Anyone have any ideas as to

Browser-independant workaround for onload event — making sense?

I have recently found myself playing around with events, and as there is no standard for the event indicating that a page has been loaded (like onload vs. pageshow) I wondered whether something speaks against simply putting some JavaScript at the end of the page. This code would then be executed when the page is loaded. In this example I

Advertisement