javascript-events

Detect when a specific image has finished loading

I have an image on a webpage which is being dynamically generated by a server-side CGI program. Periodically this image is refreshed by a timer and/or changed based on user input. So I have a Javascript function like // <img id="screen" src=""> is elsewhere in the page function reloadImage() { $("#screen").attr("src", make_cgi_url...

HTML Element, Custom Client Event

I have a composite control which emits HTML that looks like this <span id="myControl"> <select id="myControl_select"> <option value=""></option> <option value="1">Item 1</option> <option value="2">Item 2</option> </select> </span> I would like the parent span control to fire an event when the contained drop dow...

Javascript: How do I check if the key pressed on a form field is a digit (0 - 9)?

I'm using the onkeyup event on a form field in JavaScript, and I'm wanting to check if the key the key pressed is a numeric digit - ie. 0 - 9, so I can then do something with the input. <input type="text" onkeyup="" /> Would I need to use Regex for this? Thanks ...

Deactivate link with DOM click event

This question is mainly out of curiosity (I have a different working solution to the issue). Trying to do some basic progressive enhancement: a table should have each row clickable to go to another page using JavaScript. For people w/out JavaScript, there's a link in the first column of each row. If JavaScript is enabled, the links shoul...

Stop keypress event

How to stop keypress event in keydown. I have a keydown handler in that i need to stop keypress event. Actually i have a form and textbox in it. whn user press "enter" key, keydown i trigger the event and having the handler. form submit will triggered in keypress, so i need to stop the keypress event in my keydown handler. ...

keypress event in firefox not working properly.

Hello everyone. in my page i have a html textbox in which i want that a user enter some text and when he press enter(return) key the entered data should be should be passed to a javascript function. this is going well on ie8 and chrome but not in firefox. so please tell me if there is anything is special in firefox to doing this. ...

Show and Hide div's javascript works in IE but not FF or Chrome

I have a number of spans(20 - to be exact) they all have Id's. I then in my style sheet I set the visibility to hidden. I made this script to show and hide these spans once clicking on a section of the image map: function showDiv(pass) { var divs = document.getElementsByTagName('span'); for (i = 0; i < divs.length; i++) {...

get the value of "onclick" with jQuery?

Is it possible to get the current value of the onClick attribute of an A tag via jQuery? For example, I have: <a href="http://www.google.com" id="google" onclick="alert('hello')">Click</a> I want to get the onclick code so I can store it for later use (as I'll be changing the onclick event for a little while). Is it possible to do s...

Problem with Select box Onchange event in html

<script> function options(){ alert("asdfasdf"); } </script> <select type="selectbox" name="crPaymentOption" id ="crPaymentOption"onchange="options()"/> <option selected="" value="--">--</option> <option value="Check">Check</option> <option value="Credit Card">Credit Card</option> <option value="Cash">Cash</...

how to stop keypress event in keydown

how can i stop keypress event in keydown handler. ...

Server control losing mousedown event handler on callback

I have a composite server control that contains a div to which I attach a right click event handler in the Render method (simplified for clarity): protected override void Render(HtmlTextWriter writer) { base.Render(writer); writer.write(@" <script type=""text/javascript""> document.getElementById(""myDiv"").onmousedown ...

jquery lose focus event

Hello, I'm trying to show up a container if a input field gets the focus and - that's the actual problem - hide the container if focus is lost. Is there an opposite event for jQuery's focus? Some example code: <input type="text" value="" name="filter" id="filter"/> <div id="options">some cool options</div> <script type="text/javascr...

UI question: Designing a combobox to be one element high

This is a UI question, dealing with HTML and javascript, to see how to get the functionality I want without confusing the user I have a table below that has a select box as the first cell in my table. This application has no submit button. You change the select box, the database is updated, you change something in an input box the da...

How to hook IE keyboard event?

I am trying to disable browser shortcuts while user tries to press some combination of keys on the swf file. Although I can achieve this in firefox, below code does not function in ie 8. Below code is able to hook the keyboard events if focus is not on the swf file. However, what I need is hooking keyboard events when user operates on sw...

jquery cloning html problem, update DOM?

Hi, I need help of javascript / jquery experts to solve the next problem: ---- 1. this javascript alerts the id of a selected option in a select html tag: $(function(){ $("#id_productos_list").change( function(){ var op = $(this).selectedValues() alert(op); } ); }); ----2. this javascript clone html code: ...

how to convert char to keycode

how can i convert a char to its respective keycode. ...

How to write onshow event using javascript/jquery?

I have an anchor tag on my page, i want an event attached to it, which will fire when the display of this element change. How can i write this event? and catch whenever the display of this element change? ...

Javascript to fire event when a key pressed on the Ajax Toolkit Combo box.

I have the following drop down list which is using the Ajax Toolkit to provide a combo box <cc1:ComboBox ID="txtDrug" runat="server" style="font-size:8pt; width:267px;" Font-Size="8pt" DropDownStyle="DropDownList" AutoCompleteMode="Suggest...

Problem with addEventListener("click", ..) and onclick

Hi I have a html code: <a onclick="return OnDigitClick('2')">2</a> And global event handler: addEventListener("click", function(event) {...}, true); The problem is that onclick function for the 'a' element is never executed. It seems that global event handler prevents it from execution. Is there any way to solve this? Or mayby I ca...

Create a jQuery special event for content changed

I'm trying to create a jQuery special event that triggers when the content that is bound, changes. My method is checking the content with a setInterval and check if the content has changed from last time. If you have any better method of doing that, let me know. Another problem is that I can't seem to clear the interval. Anyway, what I n...