javascript-events

Problem when using Javascript to redirect user on form submit

Hi, I have a webpage on which I have a form. This form contains a button and a textbox. When the button is clicked or when the form is submitted I would like to take the text from the text box and append it to a url. The code looks like this: <form name="askaquestion" id="ask-a-question" onSubmit="window.location.href='http...

getElementsByClassName not working

I coded a php page that displays information from a mysql database neatly into tables. I would like to hide empty table rows with an onLoad event handler. Here is a sample table with code that hides a <td> when it has no content. but i can only get it to work with different IDs: <script type="text/javascript"> function ...

JavaScript: Create global Object from inside Prototype dom loaded event

I want to create an object that is globally accessible after the DOM has loaded. My approach is to use prototypes dom:loaded event and instantiate the Object. The JavaScript Code: document.observe("dom:loaded", function() { var globalPAO = new picArrayObject(); alert(globalPAO.picArray[0]); // alerts [object HTMLDivElement]...

javascript editing prompt

I am creating a web application in which i have to show an editing prompt when user wants to navigate from the page. I want to only show this when users had edited some value on that page and he does not save the changes then the prompt will ask "Do you want to save the changes ?". Otherwise if he saved then the prompt does not appear. ...

JS: How to reload the same webpage with param on dropdown change event?

I have a form in vehicles.php: <form name='vehicleform'> <select name='vehiclelist'> <option value=''>Select</option> <option value='bus'>Bus</option> <option value='bike'>Bike</option> <option value='car'>Car</option> </select> <input type='text' name='current'></input> </form> When user open vehicle.php first time then in...

not able to show iframe html content in chrome and ff but works well in IE7????

var content = "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\"\"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\"&gt; <html> <body style=\"background-color:#0C0C0C; color:#FFFFFF\"> Please Enter the credentials <form name=\"dynamicform\"> <ul class=\"edgetoedge\" style=\"background-color:#0C0C0C;\"><li>...

HTML select element onchange trigger for already selected option

I have the following HTML containing a drop down list (single selection) <script type="text/javascript"> $(document).ready(function () { $("#garden").bind('change', function() { alert("Changed"); }); }); </script> <body> <div id="...

Settimeout and setinterval memory usage

Hi Everyone, Does any body know the memory usage and possible memory leaks with javascript functions settimeout and setinterval? Thank you, Krishna ...

"this" doesn't work when binding functions to events inside a Javascript class

First off, I know I can copy "this" on instantiation, but that doesn't work here. Basically I'm writing something to track people interacting with Youtube videos. I got this working fine for one video at a time. But I want it to work on pages with multiple Youtube videos as well, so I converted the code to a class so I can create a new...

JavaScript add multiple function to event at runtime

hi All, I want to add a function to OnChange event of textbox at runtime ( on page load). But if there is already a functio define at onchange event of the perticular textbox then i need to make sure the both function get a call at onchange event. How can I achive that? I am using IE7. Thanks and regards, Tanmay. ...

Javascript eval question.

I have page A that issues an ajax call and brings in snipped B. This snippet is being added into the DOM and all the scripts in that snipper are eval-ed. In that snippet, I have 2 script tags as such: <script type="text/javascript"> function doOptions(){ alert('doOptions'); } </script> <script type="text/javascript"> X = { ...

Get epoch for a specific date using Javascript

How do I convert 07/26/2010 to a UNIX timestamp using Javascript? ...

JavaScript Dropdown Lists: Select onClick

In a web application I'm working on, I decided to consolidate a few buttons by turning them into select elements of one dropdown list, with onClick events loading for each option pressed. However, this does not work in iOS (Safari on the iPhone). Is there a different event I can use to grab menu selection from Safari for iPhone? ...

why this is giving different month

the following code below var unixDate = new Date('07/28/2010'); var unixMonth = unixDate.getMonth(); var unixDay = unixDate.getDate(); var unixYear = unixDate.getFullYear(); alert(filterDate.value); alert(unixMonth); alert(unixDay); alert(unixYear); should give me month 07 but it alrets 06....whys that ...

Trigger a keypress/keydown/keyup event in JS/jQuery?

Hello all, What is the best way to simulate a user entering text in a text input box in JS and/or jQuery? I dont want to actually put text in the input box, I just want to trigger all the event handlers that would normally get triggered by a user typing info into a input box. This means focus, keydown, keypress, keyup, and blur. I thin...

How to detect escape key press with javascript

Possible Duplicate: Which keycode for escape key with jQuery How to detect escape key press in IE, Firefox and Chrome? Below code works in IE and alerts 27, but in firefox it alerts 0 $('body').keypress(function(e){ alert(e.which); if(e.which == 27){ // Close my modal window ...

Is is possible to treat double clicks as single clicks in Javascript?

Hi I'm learning Javascript. I noticed that if I click on an object multiple times, quickly, some clicks are captured as double clicks. Is it possible to capture all clicks in Javascript as single clicks only? Thanks ...

Why can't I use onClick to execute a function inside a jQuery $(document).ready function?

I'm new to Javascript and jQuery. I want to click a button and have a js function executed. (For this example, it's just an alert, but it's actually an ajax function.) The first alert appears, but after I click the button, I never see the second ("did it") alert. It looks like javascript doesn't think the doIt() function is defined...

jQuery Interrupt ASP.net server placed <submit />

Hey all, I've got some really odd behavior i basically want a pretty styling to my buttons and i want a modal confirmation form on saving and discarding changes to a web form. the events that do the saving and desicarding are asp.net events tied to server controls, by decorating the buttons with a class i can get jQuery to make them loo...

jQuery strategy question

I have migrated frameworks from prototype to jQuery in my Rails apps, and I'm running into a consistent problem which I need some advice on. Often times I'll use an AJAX function that updates a portion of the page. When this happens, any other Javascript I use that relates to the section of the page that was updated no longer works. ...