javascript-events

jQuery fadeIn fadeOut (or show/hide) issue

I'm trying to show a tooltip when you hover your mouse on a day in a calendar control. I'm using the mouseenter/mouseleave event to fadeIn/fadeOut respectively. This works. However, my problem is since it's a calendar, there will be many days and when I'm moving my mouse across the whole week, the fadeIn/fadeOut (or show/hide) will all...

Creating the Hidden Image in JavaScript

How to disable the image display for <img src =a.gif > tag ...

Emulating Google Keyboard Shortcuts

I'm really curious how Google (and now Facebook in the photo galleries) implemented shortcut keys such as J/K or Left/Right arrows. I'm afraid I don't have many details because I can't figure out by inspecting the source which piece makes those buttons 'tic', so to speak. What I'm specifically looking for is a way to bind buttons to Java...

GWT Custom Event Handler

Can someone give me an example of creating a custom set of an Event and a Handler. Say you have a Person object that you want your widgets to know if it got updated. You create a HandlerManager and now you have to create an Event and a Handler. How would you define those classes so that you can subscribe and fire events? Most of the Ev...

Identifying the anchor tag when href is called

Hi, How can you identify in a function whether it has been invoked by an anchor tag href? event is null in this case. So event.target and event.srcElement won't work. Code HTML <a href="SomeFunction();">Href works here</a> JavaScript function SomeFunction () { // I need to get the anchor element that invoked this funct...

Javascript: script needs to wait for an element to load

Background info: I have a function that when called creates select list inside a form and populates it. After that the script runs through the options in the list and looks for a certain value. If the value is there, the script 'selects' that option. Problem: Because the list is dynamically created and is some times very large, it takes...

Tooltips (title="...") won't show in Firefox

I have an element with a title attribute (ie, a tooltip), wrapped in some container: <div id="foo"> <input type="text" title="A tooltip" /> </div> and I attach a "mousemove" event listener on the container and stop event propagation: document.getElementById('foo').addEventListener( 'mousemove', function(e) { e.stopPropaga...

Want to fire Dropdown SelectedIndexChanged Event in Javascript

I have dropdown on my page, I am changing selected value of dropdown from popup window using javascript. I have some logic in dropdown SelectedIndexChanged event, so I need to fire the SelectedIndexChanged event when dropdown selection changed from javascript. ...

Pass mouse events through absolutely-positioned element

I'm attempting to capture mouse events on an element with another absolutely-positioned element on top of it. Right now, events on the absolutely-positioned element hit it and bubble up to its parent, but I want it to be "transparent" to these mouse events and forward them on to whatever is behind it. How should I implement this? Click ...

Determining which element has focus.

Possible Duplicates: How to determine which html page element has focus? How do I find out which Javascript element has focus? Is there a way to determine which element within the document currently has focus? Ideally without having to walk through ever element. ...

Enter key press behaves like a Tab in Javascript

I'm looking to create a form where pressing the enter key causes focus to go to the "next" form element on the page. The solution I keep finding on the web is... <body onkeydown="if(event.keyCode==13){event.keyCode=9; return event.keyCode}"> Unfortunately, that only seems to work in IE. So the real meat of this question is if anybody...

ASP.NET MVC - Get reference to 'triggerElement' in onSuccess function?

Hi, is it possible to get a reference to the triggerElement that invoked the Ajax request in the onSuccess function? <%=Ajax.ActionLink("x", a, r, New AjaxOptions With {.OnSuccess = _ "function(context) {alert('get triggerElement reference here?');}" })%> ...

catch image dragged into a text field in javascript

Hei, i want to allow a user to drag an image from a web page into my web app and then store and use the image url elsewhere in the application. So i'm creating an input field as the drag target. But since that allows to drop any draggable web object (like links), i need to do some error checking. I could put a button there, but it woul...

Javascript Object.Watch for all browsers?

Hey all, I was looking for an easy way to monitor an object or variable for changes, and I found Object.Watch that's supported in Mozilla browsers, but not IE. So I started searching around to see if anyone had written some sort of equivalent. About the only thing I've found has been a jQuery plugin (http://plugins.jquery.com/files/jqu...

Prevent user from accidentally navigating away

My problem is a bit more complex than using the following simple JavaScript code window.onbeforeunload = function (e) { return 'Are You Sure?'; }; On an e-commerce web page I would like to remind the user that he has items in the shopping cart so that he can change his mind before closing the browser tab/window navigating to...

image.onload not firing twice in IE7

It works in IE6, and FireFox; but for some reason not in IE7. Using ASP.NET on the Page_Init I populate a list of chapters that are links to the image in the book as well as a javascript array which holds the pageIDs. ex. Chapter 1 --> href="javascript:seePage(4);" here is the actual code I am using: var availablePages = ['1002_001...

Custom jQuery event

I want to create my own event - OnPositionChange. Event implementation of course is not a problem. The point is, how to trigger it when top or left style has changed? Should I overwrite prototype of $.css() function, or is there a better solution? ...

Why are arrow keys, tab, etc not received by input field's onkeypress handler in some browsers?

I'm building a text input field specialized for entering and editing times. One of the parts of the functionality calls for various ways to focus on the different components of the time (hours, minutes, seconds), which I indicate through a text selection. Direct selection is possible with the mouse and this is working great. The other fe...

Handle keyPress Accross Frames in IE

I've been trying to handle the onkeydown event across multiple frames (no, I unfortunately cannot be rid of the frames) via javascript (see my previous question here). I'm getting a handle on the document in the other frame, and setting it's onkeydown handler equal to my function. No error is thrown, but when I later check the document...

IE8 only raises mouse click over text in table cell

I have an issue that arises in IE8, but doesn’t occur in IE7 or in IE8 compatibility mode. In IE8 I can only raise a mouse click event when the mouse is over text in a table cell. If the mouse is over a blank area in the same cell, the mouse click event isn’t raised. The tables are dynamically generated. The browser is running in quirks ...