javascript-events

can not use onmouseover event on select option in IE

why IE have so many problem ????? it waste lots of time..... Updated code : function getElements() { var x=document.getElementsByTagName("option"); var el = document.getElementById('selectDept'); el.onmouseover = function( myevent ) { // event = event || window.event.srcElement; if(myevent && myevent.target){ if ( myevent.t...

How do I bind a javascript event handler to the Ajax Control Toolkit combobox when textbox changed

I need a combobox for an ASP.NET project, so I decided to use the Ajax Control Toolkit combobox (http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx). I don't want to use the postback as I don't want the page reloaded, but I need to know when the text in the textbox is changed so I can call out to the server to per...

JavaScript - Detecting when neither of two inputs has focus

I want a certain function to be called when neither of two inputs on the page has focus. If the user merely switches from one input to the other, I do not want the function to be called. Any ideas? ...

How to determine if Javascript object is an event?

What is the safest way to determine if a Javascript object is an event? ...

Call Javascript function when a div turns from visibility : hidden

I want to call a javascript function when a div is turned from "visibilty : hidden" to "visibility : none;" Also note that I don't have control over the script which turns this style property of the div. I just want to hook into this. Any possibilities? Or like onFocus() etc? UPDATE : I do not want to use JQuery or other frameworks. Is...

JavaScript event.keyCode constants

When testing a JavaScript in Firefox 3.5, I have access to constants such as KeyEvent.DOM_VK_D, but not in Google Chrome. Is there a cross-browser way of accessing these constants? ...

IEs understanding of 'this'

In this code, Firefox sees 'this' as the element that was clicked and passes the href attribute through the right way. IE seems to think that 'this' as [object window] instead. How would I get this to work the same way in both browsers? Note: jQuery would be lovely, but is not an option for this project var printElem = getElementsByCl...

Onclick event handler is executed several times when I click on a link

I have an event handler that is called six times when I click on a link. var elems = elem.getElementsByTagName('a'); var cntr = 0; for(var a in elems) { AttachEvent(elems[cntr], 'click', function(e) { this.reporturl = this.href; document.getElementById('reportpopup').style.visibility = "visible"; return false; }); } I ...

Capture javascript event in IE Mobile

I need to detect the id of the element that generated an onchange event. This code work in most modern browsers: <input type="text" onchange="return onchange_handler(event);" function onchange_handler(event) { var id = event.target ? event.target.id : event.srcElement.id; ... return false; } But it does not work in IE Mo...

How to pass/escape an argument to an event handler attached using javascript?

In the code HTML+Script below, an event handler is attached after page load using setAttribute(...). The event hander is passed an argument which is read dynamically too. the event hander is attached successfully ( verified by a getAttribute(...) However, the handler does not fire. What is wrong with the snippet below? <HTML> <...

display of duplicate records in firefox

hi I am working on an online music store. There are buttons like myplaylists, mydownloads etc... On clicking on these buttons, a list of songs appears accordingly in a grid view. The problem is that when i click on the buttons twice quickly the list appears two times like 1..4..8 1..4..8 and if i click thrice quickly it happens three ti...

How to disable click events on a parent DOM object without disabling click events on its child DOM object?

I have some HTML like this: <a class="button"> <span> <span> <span class="buttonspan">Content</span> </span> </span> </a> I already have some events on the parent Anchor object. Now I am trying to add a click event on to the child span element and at the same time to disable click events on the pare...

onSubmit not triggered on form loaded with AJAX

Hi, I use AJAX to load an external HTML file, containing a form, into another HTML file. The form HTML looks something like this: <form id="..." name="..." onsubmit="postUsingAJAX(x,y,x); return false;"> Loading works fine. However, the onSubmit code is not executed when the form is submitted, same thing with onClick handlers on the s...

GWT and jQuery: how to use jQuery to remove Events generated by GWT code.

How can I use jQuery to remove a click event on an Anchor generated by GWT? For example, I have some GWT code like this: Anchor a = new Anchor("name") a.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event) { //do something } }); So it generates HTML code like this: <a tabindex="0" class="gwt-Ancho...

How to list all registered events of a DOM node using Javascript?

I can add or remove an event handler for a DOM node. Is it possible to find out all the registered events handlers of a given DOM node? I am referring to straight Javascript meaning no frameworks or toolkits like jquery, dojo, Prototype, GWT, etc. If the answer is no, any reason why? Security issues? ...

ajax calendar navigation with jquery

I have next and previous links in the html <a href="/event-sort/calendar/2009/9/sports/">prev</a> <a href="/event-sort/calendar/2009/11/sports/">next</a> When they are clicked, I want the page to make an ajax call to load a php script that will update the calendar's html now when the calendar updates, the arrows have been removed and...

Javascript: Changing link color based on stylesheet function

I am a novice Javascript programmer; any help would be greatly appreciated. I have successfully implemented a script that allows users to switch from a "regular view" to a "high contrast view". The script is simply changing stylesheets. I have also set up the script with a basic toggle: when a user clicks "High Contrast View" the li...

how pass selected index value to a change function jquery

I have a select menu that looks like this: <select id ="cal-category-select"> <option value="/event-sort/list/2009/9/sports/">Sports Events</option> <option value="/event-sort/list/2009/9/fine-arts/">Fine Arts Events</option> ... </select> when the user selects an option from the select, I need to pass the option value att...

Close a control when enter is pressed

I have a custom datepicker control inside a grid . It does not close and return to the grid when user presses enter or escape. I have the javascript code for trapping the enter key, but I need the next line of Javascript that will close the control and return to the grid. At present, I can only close the control by clicking on another...

Dynamic Script Tag Addition is Asynchronous?

Is Dynamic Script Tag Addition is Asynchronous? Like dynamically including set of JavaScript files from a different domain.. Thanks in advance ...