javascript-events

Can't focus input field in DOM loaded with ajax call

I have gone insane trying to figure out how to make this work. Code looks roughly like: function onDropDownChanged() { $("#updatePanel").load( "myUrl", { id: $("#myDropDown option:selected").val() }, onPanelLoaded ); } function onPanelLoaded() { $("#theTextInput").focus(); } $(document).ready(function() { $("#myDropD...

Run JavaScript when an element loses focus

I have a standard HTML input that I want to run JavaScript code when it loses focus, sadly my Google searches did not reveal how to do this. To make it clear, I'm looking for a way to do this: <input type="text" name="name" value="value" onlosefocus="alert(1);"/> ...

Measuring when only certain page elements have loaded

We use a modified version of Jiffy to measure actual client-side performance. The most important thing we do is measure the time between when the request was received and when the page load event fires in the browser. On some pages we have iframe elements that point to external sites that we don't control - they sometimes take a long w...

Copy Paste using Javascript

I have two textBoxes lets say EmailID and UserId. Currently when a user Types his/her EmailId the same gets shown in the UserID TextBox, for this I am using OnkeyDown event javascript. The Issue That I am having is if the user copies the EmailId an Paste it in the EmailId textBox then the OnKeyDown event is not fired, is there any other...

How can I reference the element that contains the event from the function called?

From inside of the fireAlert() function, how can I reference the element that called it, without having to pass this as an argument through the link? <script type="text/javascript"> //function function fireAlert(){ alert(); } </script> <a href="javascript:;" onclick="fireAlert();">Fire</a> ...

Javascript key press buffer issue.

I have a function which starts to gobble up keys after a hot key is pressed and fires off an AJAX process at the end of a sequence (barcode scan). The issue is what happens if the user accidentally presses the hot key? My paper napkin solution was: on hotkey: if(okay(true)) {buffer=""; ts=now(); consumekey();} on EOTkey: if(okay(false...

Using .onKeyUp and .onChange with Javascript DOM objects

I'm having a weird problem with some Javascript/DOM code I've ben playing with. I'm trying to assign the .onKeyUp and .onChange events/methods to a text input like so: form.elements["article"].onkeyup = "alert('test');"; Oddly, assigning using that method is doing nothing, and I'm forced to do this manually using: form.elements["arti...

Onsubmit form validation function not working in IE

Hi all, Im working on a simple javascript validation function for a html form, but have run into issues with it using IE7. I dont get any error messages, the form simply submits without validating. Firefox, and Opera work fine, so Im really not sure what i am doing wrong here. Ive googled around, but not found anything helpful, or maybe...

How can I monitor the value of a hidden input element?

I have a SELECT element which adds its value to a hidden INPUT via Javascript every time an OPTION is clicked (along with a visual representation of each selection) and I'd like to be able to monitor changes for another Javascript function. For the sake of modularity, I can't integrate the second function into the first one. I would also...

How to make textarea editable?

Hi all, I have a textarea which converts english to hindi onkeyup event.But when i move the caret backward for editing, the first letter I type converts to hindi and the caret moves to the end of the string.Can it is posible to store the caret at the same point within the textarea,so that it doesn't moves to the end of the string.. Waiti...

Clear/Remove JavaScript Event Handler

Greetings all - Given the following HTML fragment: <form id="aspnetForm" onsubmit="alert('On Submit Run!'); return true;"> I need to remove/clear the handler for the onsubmit event and register my own using jQuery or any other flavor of JavaScript usage. Anyone know how to do this? Thanks - Jordan ...

Why this unbind doesn't work ?

I try to answer this question a few minutes ago and prepared this example for myself : <script> function trialMethod() { alert('On Submit Run!'); return true; } function trialMethod2() { alert('On Submit Run trialMethod2!'); return true; } </script> <form id="aspnetForm" onsubmit="trialMethod();"> <input type="...

Javascript that executes after page load

I'm executing an external script, using a <script> inside <head>. Now since the script executes before the page has loaded, I can't access the <body>, among other things. I'd like to execute some JavaScript after the document has been "loaded" (HTML fully downloaded and in-RAM). Are there any events that I can hook onto when my script e...

Getting associated img from HTML area

Hello, There are two img elements that use the same map with one area. Now, we bind e.g. a click event handler to the area element. Is it possible to determine from the event handler which image instance has been clicked? ...

Problem with local variable inside an event in javascript

Hi, I am delevoping a page which has a re sizable and draggable div. An I have attached mousedown, mousemove and mouseup event handlers to this div. The problem is with the mousemove event handler. I have to get the current width, height, top and left of the div. For that I am using functions to return the specific values and I have to...

Key code check in Javascript not working for IE

I tired to write a function to check key code with javascript. It's working fine for firefox but not IE. Does anyone know what is going wrong with my code? Please see below code for more details. function textCheck(e) { var e = window.event || e alert("CharCode value: "+e.charCode) alert("Character: "+String.fromCharCode(e.charCode))...

jQuery event handlers not firing in IE

I have a list of items on a page with a set of controls to MoveUp, MoveDown and Delete. The controls sit at the top of list hidden by default. As you mouseover an item row, I select the controls with jquery //doc ready function: .. var tools = $('#tools'); $('#moveup').click(MoveUp); $('#movedn').click(MoveDn); $('#delete').click(Dele...

Javascript Object Confusion...

I've confused myself nicely here. My scenario is as follows. function DesignPad() { function EditBar() { ... this.removeHandler = function() { **// how do I call Dragger.removeAsset** } } function Dragger(){ ... this.removeAsset = function() {} } this.init = function() { this.editBar = new...

javascript open.window returns null in called function

Hi there can anyone help, i have a developed a function that when called should open a window but it returns NULL. If i do the opening window in the original javascript function it works. I suppose its the original function passes control to the other function but for some reason this doesn't work.. Here is my original function, this b...

Lazyweb: Is there something funny about how IE7 does onMouseOver javascript on li elements with text?

I'm an Ubuntu user, so I'm not knowledgeable of Internet Explorer. We have a javascript based drop down menu thingie using li's and ul's and all that. It works fine in FF and IE6. However not in IE7. It looks like IE7 doesn't call the onMouseOver function unless you go over the text in the middle, as opposed to the blank area between the...