javascript-events

javascript onclick get url value

i will like to get a url value upon onclick. like this: www.google.com/myfile.php?id=123 i want to get id and its value. thanks ...

javascript cross browser scripting help

Hi Guys, I have a tiny function I use to only allow numeric input. It works great in IE, but I cannot get it to work in FireFox or Chrome. I have this js file loaded in my script tag of my HTML page. var numberOnly = function(evt) { var theEvent = evt || window.event; var key = theEvent.keyCode || theEvent.which; key = String....

Flash Stage Losing Focus

I built this incredibly brilliant scrolling thumbnail image viewer for a client in flash actionscript 3. (Basically it just scrolls up or down depending on the mouse position). It works so so, (I can never get the percentages right so that it shows the top most image) but, that's beside the point. What is REALLY irking me is when I h...

Is it possible to get a browser window to update while it is in a Javascript loop?

I have an Ajax call that currently needs to be synchronous. However, while this Ajax call is executing, the browser interface freezes, until the call returns. In cases of timeout, this can freeze the browser for a significant period of time. Is there any way to get the browser (any browser) to refresh the user interface, but not execute...

JavaScript inline events syntax

Is there any reason to use one of the following more than the others: <input type="button" value="b1" onclick="manageClick(this)" /> <input type="button" value="b2" onclick="manageClick(this);" /> <input type="button" value="b2" onclick="manageClick(this);return false;" /> <input type="button" value="b3" onclick="return manageClick(this...

Setting marker zIndex in IE

I'm trying to set zIndex to markers, mainly, i want to set all green markers on top. The code below works GREAT in any other browser but IE! I'm checking in the marker is green if it's containing 'st1' in the filename. I'm using mootools so the code is a bit mootools specific, but any javascript help would be appreciated: gmarkers.ea...

Event listeners in javascript

Does javascript have a sort of event listeners? My scenario: I want to execute Inc function 2 times with different parameters, first execution of Inc and then the second execution, but the second execution must be executed after X seconds (settimeout...) after the first Inc function is completed (all it's iterations, as soon as clear...

Why the subtle cross-browser differences in Event Object.

The following declaration at the window level: var event; // for IE var event = "anything"; // for Chrome will destroy the event object as used here: <div onMouseOver = "alert(event.type);">Mouseover Div</div> Firefox does not seem phased by either declaration. I realize that declaring a variable with the name "eve...

Javascript event object is not being populated in event handler function

I have the following code: Html: <tr> <td onclick="ThingClicked()">click me</td> </tr> JS: function ThingClicked(event) { var row = event.currentTarget.parent("tr"); callAnotherDOMManipulatingFunction(row); } For some reason, event.currentTarget is undefined. I tried 'this' but that was undefined aswell. What's going...

Making events fire in iE6 while <select> is active and dropped down

I am pretty sure this is just a limitation of iE6, but I thought I better ask just incase: <body> <h1>Select + event test</h1> <div> <select> <option>ABC</option> <option>123</option> </select> <span id="eventSrc">Event Source</span> </div> <div id="log"></div> <scr...

How do I make an addon run a function whenever a page is loaded.

I am developing a firefox addon and I want it to add an event listener on every form field. How would I implement this. ...

Onmouseover child div problem and event bubbling

I have a small div above (hover) a big one. I assign onmouseover and onmouseout events to the wrapper div. For image caption roll-over animation. The problem is when the mouse is above the caption itself, causing an unwanted result(probably event bubbling). And another problem: sometimes when you move mouse from outside to container...

Html.Dropdown list events in MVC

Hi all, Can anyone please tell me about - How can i handle Html.DropDown control's events in MVC View? Can I handle it using scripts? And how to know about the selected item? Thanks, kapil ...

Setting events dynamically

I have this function that that I invoke onload: function InitAll(){ document.getElementById("div1").onmouseover = function(){Foo(event,this);}; document.getElementById("div1").onmouseout = function(){Foo(event,this);}; } function Foo(e, handler){ document.getElementById("label1").innerHTML=e.type; } In IE it works and...

How to ignore Onmouseover in javascript on div with absolute position

Hi, I have the following code: <body> <div id="div1" style="position: absolute;"></div> <div id="div2" onmouseover="not handling"></div> </body> div1 covers div2. I need to handle onmouseover on div2. I assume that div1 handles the onmouseover event and postpone it to the body (because the body is a parent element). I cannot chang...

JavaScript objects and persistence through dialogs

Hi, Rather simple question here. I want to create an JS object that has a property, say, name. I want to create that object and be able to use it throughout my page. For example, what I have now doesn't work: var item = new Object(); function makeItem(title) { item.name = title; } Inside a modal dialog: makeItem("test"); alert(i...

Execution sequence of DOM events registered using jQuery

I am using a checked selection list in my application. It has an "All" option which, of course, selects all the available options in that list. For that, I have attached click event to the All checkbox. Now, based on the selection, I have to make appropriate changes in UI as soon as the selection criteria is changed. I have implemented ...

Trigger onmouseover event programatically in JavaScript

Is there a way to programmatically trigger the onmouseover event in plain JavaScript? or "extract" the method from the onmouseover event to call it directly? eg <div id="bottom-div" onmouseover="myFunction('some param specific to bottom-div');"> <div id="top-div" onmouseover="????????"></div> </div> top-div is above bottom-div, s...

how to block users from closing a window in javascript?

Is it possible to block users from closing the window using the exit button [X]? I am actually providing a close button in the page for the users to close the window.Basically what im trying to do is to force the users to fill the form and submit it.I dont want them to close the window till they have submitted it. guys i really apprecia...

Fire keydown event in different browsers

I was looking long time to get answer to this task: fire a keydown event programmatically compatible under different browsers like IE, FireFox, Opera, Chrome... now I found it and i would like to share it with programmers, You may use it to fire event of any type. <html> <body> <script language="JavaScript"> function first() { var ...