javascript-events

Jquery Listbox Change event does not fire on Keyboard scrolling

I've got a simple Listbox on a HTML form and this very basic jQuery code //Toggle visibility of selected item $("#selCategory").change(function() { $(".prashQs").addClass("hide"); var cat = $("#selCategory :selected").attr("id"); cat = cat.substr(1); $("#d" + cat).removeClass("hide"); }); Th...

Internet Explorer and <select> tag problem

I am having the following problem under Internet Explorer 7/8: I have a popup that gets activated when user mouseover a link. The popup is a simple <div> that contains some data. Inside this <div> tag there is a <select> tag with some <option>s. I have attached mouseover/mouseout events to the <div>, so that this popup will stay open wh...

How to check in JavaScript if XMLHttpRequest object supports W3C Progress Events?

Is there any way to check within JavaScript if XMLHttpRequest object supports W3C Progress Events? I mean here if setting onload, onprogress, onabort, onerror, etc. properties to some handler function would have those function called those events, as described. Additional (bonus) question: is there a way to augment XMLHttpRequest (e.g....

attachEvent gives trouble

Hello everybody. I am trying to do drop down horizontal menu in javascript. It's works fine on Firefox and Chrome, however giving me troubles in IE. Here is the code i have function init(){ hideAllSubMenu(); var menuItem = document.getElementById("menu_wrap").getElementsByTagName("div"); for(var index = 0; index < menu...

Adding new text box using javascript

I have a webpage. There is a button called add. When this add button is clicked then 1 text box must be added. This should happen at client side only. I want to allow the user to add at most 10 text boxes. How can I achieve it using javascript? example: only 1 text box is displayed user click add > 2 text boxes displayed user clicks ...

how to access the selectionRange using the onselect event object in textarea

I am working on a project where I will be getting all the events that have occurred in a textarea and give a replay of the events. To fulfill this objective, I am collecting all the events that have occured in a textarea. I am storing the events in an object array containing the event and timestamp. Now for onselect events, how do i get ...

JQuery 'Change' event handler for asp.net radiobuttonlist not firing

I wired the Change event handler for an ASP.NET radiobuttonlist like this in the ready() handler in JQuery like this: $("#<%=rblYesNo.ClientID%>").change(MyFunction); When I select one of the radio buttons, MyFunction doesn't get called. Why? ...

Problem executing trackPageview with Google Analytics.

I'm trying to capture the clicks of certain download links and track them in Google Analytics. Here's my code var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { linkpath = links[i].pathname; if( linkpath.match(/\.(pdf|xls|ppt|doc|zip|txt)$/) || links[i].href.indexOf("mode=pdf") >=0 ){ /...

Delaying default events in Javascript

I would like to be able to delay the default action of an event until some other action has been taken. What it's for: I'm trying to build a reusable, unobtrusive way to confirm actions with a modal-type dialogue. The key wishlist item is that any javascript handlers are attached by a script, and not written directly inline. To make th...

Javascript with an ascx control

I designed an ascx control (I refer to it in this question as customControl). The control is just a series of drop downs with text values in each drop down. The drop downs are inside a panel. Here it is below: I then place a few of them on a page that also has a textbox (I refer to it here as textbox) Here it is below: So what I ...

How can I notify the parent page when a popup has finished a load which the parent initated?

My main HTML page does the following: var popup = window.open(...); // Wait for popup to load popup.onload = function() { do_something(); }; popup.location = "new-page.html"; I'd like do_something to be called when new-page.html is finished loading. But what I currently have doesn't work -- do_something is never called. How can I ma...

Accordion Menu - How do I know that it will slide up or down??

Hi I have a question I got an accordion menu(code below) and under the accordion menu I have a tag box. When accordion menu extends, I want to make my tag box go below the extended menu instead of extended menu covering up my tag box. So I change the value of css property "top" for my tag box after I count the # of sub-items being opene...

jQuery - Check which divs are visible - fade function not allowing for immediate checking ?

THE SITUATION i have a series of divs setup to contain various content: <div id="main"> <div id="about"></div> <div id="contact"></div> <div id="flickr"></div> <div id="twitter"></div> </div> I also have a nav which fades in and out specific divs from above (using either the animate or fade functions). THE PROBLEM...

How to pass an event object to a function in Javascript?

Hi <button type="button" value="click me" onclick="check_me();" /> function check_me() { //event.preventDefault(); var hello = document.myForm.username.value; var err = ''; if(hello == '' || hello == null) { err = 'User name required'; } if(err != '') { alert(err); $('username').focus(); return false...

JQuery replacing image problem

Hi, I want to extend some JQuery code to replace an image once I click on it. I have this: var minimiseContent = function(e) { var targetContent = $('div.itemContent', this.parentNode.parentNode); if (targetContent.css('display') == 'none') { targetContent.slideDown(300); var minIcon = $('minimise', this.parentN...

How do you redirect a user to a new page when a JavaScript timer expires?

How do I write a JavaScript timer that will automatically redirect my users to a different page when the timer expires? ...

Add events to anchors when using link_to and :method => :post instead of inline javascript?

So I'm jumping into Ruby on Rails with Agile Web Development with Rails. I got to the part where you use: <%= link_to (image_tag(product.image_url), {:action => :add_to_cart, :id => product}, :method => :post) %> In an attempt to be RESTful, Rails kicks out this inline javascript on each anchor tag onclick="var f = document.createEl...

How to wait for a Java applet to finish loading on Safari?

Hi, This doesn't work in Safari: <html> <body> <applet id="MyApplet" code="MyAppletClass" archive="MyApplet.jar"> <script type="text/javascript"> alert(document.getElementById('MyApplet').myMethod); </script> </body> </html> myMethod is a public method declared in MyAppletClass. When I first load the page in Safari, it shows the ...

JavaScript event for when image 'src' attribute is changed?

I have a function resizePreview() that will resize an image in a jQuery dialog box if the image is too big. This image can be changed by the user. My code goes something like this: $('#imagePreview').attr('src', newImageSrc); resizePreview(); resizePreview() uses $('#imagePreview').width() and .height() to get the dimensions and res...

Javascript not Working on FF

I have the following code which works perfect in IE for a textarea element. (ed: wrapped for readability) <textarea name="mem_message" cols="25" rows="5" onkeypress="return taLimit(this)" onkeyup="return taCount(this,'myCounter')"> <? echo $_SESSION['mem_message']; ?> </textarea> It calls a validation function: <script lang...