javascript-events

What is DOM Event delegation?

Update Can anyone please explain event delegation in JavaScript and how is it useful? Original: Delegation in programming. Can anyone please explain delegation and how is it useful? ...

<textarea> what key was pressed with javascript

Hello! I would like to ask somebody how i can determine what key was pressed in a textarea.... need to write a little javascript code.. a user type in a textarea and i need to write it in a while he writing so the keydown, keypress event handle this functionality, also need to change the text color if a user typed a "watched" word (or t...

Impromptu plugin for Alert Boxes.

Hello. When we use Javascript promt Box something like this var ur_name = prompt("Enter Name"); We will have two types of values in this case: Value entered by user. Second VALUE can be NULL, when user press CANCEL or When he presses ESCAPE Key. Right...!!! Now The problem i m facing is: HOW to Handle escape key in Impromptu plu...

Javascript stop event flow

Hello, first of all sorry for the strange title but I wasn't sure how to call this. I am trying to create a slideshow for images. Actually it's more like a fade in and out show. I could explain the whole thing but I think it's a lot clearer if I just posted my code. var Images = ["images/1.jpg", "images/2.jpg", "images/3.jpg", "images...

dispatch window load event

I need to dispatch the window's load event in javascript. There is plenty of documentation on how to dispatch mouse events, But I can't find any on load events. It only needs to work in firefox. It would be equally helpful if I could "spy" on the window's load event, because then I could just call the function. Using the "Event spy" ...

determining mouse position on a window focus event

I've attached a focus listener to window (using prototype syntax): Event.observe( window, 'focus', focusCb.bindAsEventListener( this ) ); I want to determine the mouse position when the window is focused. Unfortunately, in my focusCb method, I don't seem to have access to pageX, pageY, clientX or clientY. Using quirksmode code: fun...

Integration of hosted site with external features

I have a hosted Q&A site that I'm looking to augment with additional features not provided by the host. I'm comfortable implementing the server-side features (they should take me around 6-8 weeks), but I'm not able to modify the Javascript that handles the posting of questions/answers. I'm puzzling over how to add extra scripts that can...

Need to use body onload event, but third party JavaScript library has hijacked it.

I'm using Simile to draw dynamic timelines. I am also using an in-house library to add a comment blog. Our in-house library uses the body element's onload event to initialize. <body onload="initComments('myID')"> But Simile seems to have hijacked the onload for their own purpose so that initComments('myID') never executes. Short of...

Intercept page exit event

When editing a page within my system, a user might decide to navigate to another website and in doing so could lose all the edits they have not saved. I would like to intercept any attempt to go to another page and prompt the user to be sure they want this to happen since they could potentially lose their current work. Gmail does this ...

Triggering jQuery event when 3 specific elements are visible

Here's to hoping this makes sense. I'm testing a new version of my personal site at http://joshuacody.net/jc3/ I'm looking to display my works in a bit of an interactive style, using jQuery. You can see that each image is mis-matched, but it has a rotator. And you can rotate each image to line all three up. When all three are lined u...

Detect double Ctrl keypress in JS

I have a custom CMS and would like to add a "shortcuts menu" triggered by the pressing of the Ctrl key twice within, say, 300 milliseconds. I use prototype, so my starting point obviously is: Event.observe(document, 'keypress', function(event) { if(event.keyCode == Event.KEY_XYZ) { show_shortcuts}); My approach at the moment would ...

how to bind and unbind third party jQuery library function?

I've create code to add table row with formfield, and try to bind the 3rd party suggestbox function the each dynamic generate formfield <script type="text/javascript"> $(document).ready(function() { $('#form1').validationEngine(); var newRowNum = 1; $(".addRow").click(function(){ var $newTr = $("#tb1 tbody>tr:last").clone(true); ...

matching password in .net validate by javascript ?

i have two textbox in asp.net and first for password and second is for matching password .. if user give different value in both textbox , then i want to generate javascript at client side.. ...

Can User disable javascript at client side ? is it possible ?

it is possible to disable javascript from browser ? ...

Using jQuery, setting Draggable on an element prevents blur from firing when you click the draggable element.

Using jQuery, when you set a blur event on a text box and set another element as draggable, when you click the draggable element, the blur event does not fire in FireFox. IE is a little better, you get the blur event but you don't get the click event on the draggable element. If you don't specify the cancel: "" in the draggable constru...

Javascript validation For .net dropdownlistbox control?

i have 3 dropdownlistbox.. 1.country 2.state 3.cities when i am seleting country name.. as per it..state name and city name change. in that if i am changing state name then city name is changed in dropdownlist box.. using only javascript not postback of .net control. i have faced so much problem by making array of country,states and ...

ASP.NET MVC List population in strongly typed views

A bit of background: I'm building an MVC app to store golf course data and have created a Create view page for the courses. This contains a partial view of a scorecard that I am going to use for other things such as recording results etc. I've currently built the scorecard so it fires off jquery triggers when it is edited. From which t...

JQuery UI; Stop propagation of selectable events

Basically I am using jQuery ui's selectable functionality on a ul, but the ul will often times have a scrollbar, and this scrollbar becomes unusable in Webkit browsers since when you try to click on it to grab it, the lasso for the selectable functionality is drawn overtop instead. I have formulated a solution, which involves checking t...

window.onbeforeunload not firing in child window

I want to bind a function to the beforeunload event of a child window in Javascript. I have the following code: newWind = window.open(settings.url, "Dialog", "width=" + settings.width + ",height=" + settings.height + ",resizable=" + settings.resizable + ",scrollbars=" + true); newWind.onunload = function() { alert('test'); } Works fi...

How can I attach JavaScript events to table cells created at runtime?

I have a page with two links. On each, I've attached a JavaScript onmouseover event. I require a tooltip to be displayed when the mouse encounters a link, and require that it should not disappear until I point the mouse at the other link. The problem is that I create table at runtime, and I want to display tooltips for the table cells ...