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
Tag: dom-events
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
How to listen for changes to the title element?
In Javascript, is there a technique to listen for changes to the title element? Answer 5 years later we finally have a better solution. Use MutationObserver! In short: With comments: Also Mutation Observer has awesome browser support:
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
Is it possible to get the location/position of the mouse cursor on document load event
Just wondering if its possible to get the x/y location of the mouse from the onload event of the document (before any mousemove events)? Answer short answer: no long answer: yes. the onload event doesn’t provide info on the mouse position, however you can set a variable when onload has fired, and use the onmousemove event on the document to
How to block users from closing a window in Javascript?
Is it possible to block users from closing the window using the exit button [X]? I am actually providing a close button in the page for the users to close the window.Basically what I’m trying to do is to force the users to fill the form and submit it. I don’t want them to close the window till they have