javascript-events

How to generate a right-click event in all browsers

A little context: The app I'm working on has a right-click context menu for certain objects on the screen. The current design as that each of these objects listens for a right-click, sends an AJAX request to get the context data for that object, uses that data to create a PopupMenu2 from Dojo 0.4.3 (I know!), and then generates a right-c...

Enumeration of event handlers

Is there a way to list all event handlers an html element supports? ...

Disabling key functionality in browser

I am writing an application in JavaScript (w/ JQuery). The application has a lot of functionality that the user needs to access quickly and possibly at the same time (you could think of it as a game, even though it's not a game) so I've set it up to use the keyboard. I've got a prototype of the system working (in Chrome, at least), but...

JavaScript performance benchmark in handling events at parent for all child elements

Handling events for several child elements in bubbling phase at parent node is common. However, I am not sure if there are any performance issues in it. For instance, Consider the following structure: <div id="parent"> <div>child1</div> <div>child2</div> <div>child3</div> </div> Now If i want to handle onclick on each of t...

Handle User Input with Raphael

I'd like to write a simple game using the Raphael javascript library, but one question is sticking in my mind. How does one handle keyboard input? I've looked through the reference material and haven't found any reference to this. Can you simply pass it the standard JavaScript keypress methods? ...

Make the OnMousedown event to be triggered only after the OnBlur event is triggered

We have a HTML screen that is formed by including the two sections below: Footer - A bar with icons that includes an Update button. The update button has the onmousedown event associated with it. When the Update button is clicked the data present in the Body is saved in the database. Body - HTML form with 2 input fields. Each of thes...

How can I disable Alt-Enter in IE?

Hi, As the default behavior of IE is to switch to the full screen mode on Alt-Enter command. I've to avoid this and have to attach a custom behavior. Is it doable? Thanks. ...

Javascript after window.onload?

I have an asp.net page that loads some javascript scripts. One of those scripts loads some controls into the page appending them to the body in the window.onload event. I need to inject a script via code behind to call a method of the scripts that depends on the controls created in the window.onload. This doesn't work because every call...

How to prevent the default action with mootools

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <script language="JavaScript" src="mootools-1.2.3-core-nc.js"></script> <script language="JavaScript" src="mootools-1.2.3.1-more-nc.js"></script> </HEAD> <BODY id='body'> </BODY> <Script> function onkeydown(e){ ...

onchange event never happens on IE while ok with firefox

Hello It might be a beginner question but I can't understand why the onchange event is never called by IE while it works Ok with firefox. <input type="text" id="mytext" size="48" value="" onchange="execute()"/> <button type="button" onclick="execute()">Go</button> The execute function is called when the button is clicked but not when...

Could I find the function invoked by an event in run-time?

I want to find that when a user fires an event, such as click a button, what function(s) does this event invoke at run-time? Would it be possible? Thanks! ...

List all available javascript Events

How can I trace all javascript events of a Webpage? Is there a possibility to trace all events, even such without a handler attached? Is there any tool out there, that can do this? Clarification: For example: For a text input i can add an event handler for onblur and onchange. If I (in the browser) change the value of the textfiel...

Fire tab keypress event in JavaScript?

I'm trying to simulate an actual tab key press in JavaScript. I don't want to focus on the next element or anything like that, I just want to make it seem like the tab key has been pressed. The reason why is because I am building a form JavaScript class where I want to be able to use the enter key just like tab. If someone is using a na...

jQuery Click/Change event not working properly in IE7/8

I am binding an event to a checkbox's change or click event which works fine in Firefox but in IE I have to click anywhere else (causing the blur) event before the event is fired. I have read and believe this is down to the way IE fires the events, but is there anyway I can get round it?! The whole point is that it is a smooth search f...

Override javascript Window.opener

I have a pop-up window from an exiting application that I want to trap inside a lightbox using an iframe. This is working well except for one thing. When the pop-up is "done", it calls Window.Opener to reload the parent window. I want to override this so that I can do something else when it attempts to call this function. I'd prefer ...

How to determine event of textbox when selected from the autocomplete list in javascript?

Hi all, how to determine the event of a textbox when the item is selected from the autocomplete list in javascript? my requirement is, i have a textbox and a button. initially button will the disabled. onkeyup event i am enabling the button. this works pretty cool.. but here is the tricky part... when the user is selecting some item from...

Troubleshooting Raphael translation animation

Hi, I'm attempting to use Raphael to make a small game, and just want a bit of advice on some code I'm working on. Here's what I have so far, its just a simple example of moving a circle around the screen: <script type="text/javascript" charset="utf-8"> window.onload = function () { var paper = Raphael(10, 50, 320, 200); var paper ...

Is it possible to stop the browser from following the link when the onclick of the child element fires?

This is what I have basically: <a href="http://somelink.com"&gt; <span>stuff</span> <span onclick="AwesomeFunction();">more stuff</span> <span>the last stuff</span> </a> Now, the problem is I want to keep the parent as a link but if the user clicks the span with the onclick event I don't want the browser to follow the link...

capture mouse position on setInterval() in Javascript

I have a function in javascript that moves one div depending on the mouse position. This function is set on a setInterval() function and executed every second. I need to capture the mouse position like this: function mousemov() { document.getElementById("myDiv").style.left = Event.clientX; //don't work } window.onload = function() { ...

How to attach an event to onSubmit event of form with chaining earlier attached methods as well?

Actaully my application is having hundreds of pages. Now i have to attach an event 'disablePage' on onSubmit of form. I don't want to go to each and every page and write: <form name="frmname" onSubmit="disablePage();"> What i am doing right now is:- excerpt from common.js file; [ included in all pages ] /* we have to attach 'attachF...