javascript-events

JQuery event not working on async postback, fixing on 2nd postback, breaking on 3rd

Here is a simplified version of my page: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"&gt;&lt;/script&gt; <script language="javascript" type="text/javascript"> var cbFuncInit = f...

Handling onclick event if no GUI element was clicked

To make it more clear what I need to do, here is the structure of the search form / HTML page I am working with: --- |A| --- --------- --------- --------- | | | | | | | B | | B | | B | | | | | | | --------- --------- --------- -----------------------------...

global Javascript files and naming conventions (unobtrusive javascript)?

Hi there, I am trying to reorganize my javascript into JS files and clear out my js from my html... The way i see if is the following.... I would really like some input or any documentation/information confirming my plans - a little uncertain. Basically if i have a Home.htm file then i will have a home.js file also, notice they are na...

Excluding form fields from keypress handler assigned to body

I have a keypress handler on a web page assigned to the body element. I really do want it to be active anywhere in the web page. Or so I thought. The keypress events in textual input forms also activate the body handler, which makes sense, but which I don't want. Ideally, I'd like to keep the keypress handler assigned to the body ele...

How to skip the method if the event is generated from specified button?

This is in continuation of http://stackoverflow.com/questions/1613744/how-to-attach-an-event-to-onsubmit-event-of-form-with-chaining-earlier-attached-m Now, i am having disablePage method which will be executed every time there is any submit event occurs. But i don't want this method to execute if the event is generated from export bu...

Text in HTML Field to disappear when clicked?

I can easily create a html input field that has text already in it. But when the user clicks on the input field the text doesn't disappears but stays there. The user then has to manually remove the text to type. How can I create an input field where when the user clicks on the input field box the text then disappear? ...

How to add an onchange event to a select box via javascript?

I've got a script where I am dynamically creating select boxes. When those boxes are created, we want to set the onchange event for the new box to point to a function called toggleSelect(). I can't seem to get the syntax right to create the onchange event. Can someone tell me what I'm doing wrong? It doesn't throw an error, but doe...

how to add double click event on a table row using javascript???

var nextRow = tbl.tBodies[0].rows.length; var row = tbl.tBodies[0].insertRow(nextRow); row.setAttribute('ondblclick', "return move_to_x_graph();"); this code will add a double click event on row.. Right.. But the thing is its not working in case of internet explorer.Its workin fine in case of all the other browsers.. For adding sty...

Downsides of onMousedown vs. onClick?

I've been dealing with a bane-of-my-existence Javascript problem involving tracking when a user clicks on a link (in case you're curious, here it is: http://stackoverflow.com/questions/1629158/why-does-using-targetblank-cause-javascript-to-fail). I've figured out that I can solve the problem by tracking an onMousedown event rather than ...

jQuery change event on <select> not firing in IE

I've got a page with a variable number of <select> elements (which explains why I'm using event delegation here). When the user changes the selected option, I want to hide/show different content areas on the page. Here's the code I have: $(document).ready(function() { $('#container').change(function(e) { var changed = $(e.target);...

Difference between onMouseOver and onMouseEnter

I'm trying to have a simple html table, that highlights a row as a user mouses over it. Unfortunately the css hover item doesn't work for IE. That leaves me to simulate it in javascript. I can use either onmouseenter or onmouseover. What is the difference between them, and which one should I use? ...

passing json data on trigger

I am calling a service that return json data. script: $.ajax({ type: "POST", url: "/some/service", dataType: "json", success: function(response) { if (response.status == "ok" && response.messages.length > 0) { // obj is a jQuery object obj.trigger(SOME_EVENT, response.messages); ...

Lag problem with jQuery focus() and blur() events.

I'm attempting to create a navigation menu that uses some jQuery. I wanted keyboard users to be able to have the same experience as mouse users, so I'm duplicating the functionality found in my hover() event handler in my focus() and blur() event handlers. For some reason, this is causing noticeable lag in Firefox and IE when the user cl...

Is it possible to create a form using only JS?

Hi All, I am trying to create a form using only JavaScript. I mean create a form for a web page, add elements to it, set their values and submit the form. Moreover, if JS is disabled in the browser the normal HTML form should get submitted. Is there any way to achieve this? Thank You All. ...

Prevent Enter from selecting a single item in a list box

I have a multi select list box. I want to be able to select a number of items and act on the selection by pressing the Enter key. The problem I'm having is that when I press Enter the current item at the cursor becomes the only item selected. The others are deselected so my function only acts on a single item. What can I do to prevent th...

Can I accept an image that is dragging in HTML?

In many browsers today you can click and drag images. Can I leverage this in any way? Could I receive an event when an image is dragged and dropped on top of another image in the same browser window? ...

keycode on keydown event

I'm using keydown event where i get the keycode and convert it to charcode. But i got a problem where in keyboard is press "2" it gives 50 and charcode as "2" whn i press "2" in numpad it gives keycode 98 , so whn i convert charcode "a" help please, on Advance thanks, Santose ...

mouseover and mouseout events firing on children

The code: <div id="Navigation" onmouseover="new Effect.toggle('Drop_Down','slide',{duration: 0.8});" onmouseout="new Effect.toggle('Drop_Down','slide',{duration: 0.8});"> <div id="Drop_Down"> <% include Navigation %> </div> </div> If I mouseover the Navigation the Drop_Down div slides down, and if I mouseout ...

Getting events 1 character at a time in Javascript

Hi, I'm pretty new to javascript, so bear with me if this is obvious. Basically what I would like is to implement a little interface where when you type something in a textbox it gives an event. Sorta like how this stack overflow post preview works. I tried hooking into the OnChange event, but that only gives an event when they are done...

Ignore mouse interaction on overlay image

I have a menu bar with hover effects, and now I want to place a transparent image with a circle and a "handdrawn" text over one of the menu items. If I use absolute positioning to place the overlay image above the menu item, the user will not be able to click the button and the hover effect will not work. Is there any way to somehow di...