javascript

jQuery - How can I temporarily disable the onclick event listener after the event has been fired?

How can I temporarily disable the onclick event listener, (jQuery preferred), after the event has been fired? Example: After the user clicks on the button and fires this function below, I want to disabled the onclick listener, therefore not firing the same command to my django view. $(".btnRemove").click(function(){ $(this).attr("s...

weird javascript image map behaviour with update panels in Chrome

I have discovered an odd bug in one of my apps when using Chrome. The app displays images with image maps which trigger javascript events. The images/maps are in update panels. When the update panel refreshes, the image changes, and if you inspect the element the image map appears to have changed, but Chrome is still calling the old java...

Javascript problem when mixxing Cutesoft Edit and Colorbox

I have a slight javascript problem, and this is the reason to why i dislike javascript. On my page i use Colorbox to popup a div with the possibility to add a new image. Then i use Cutesoft Editor as an Image Picker that opens a Window where the user can select an image. My problem is that the Image Picker window opens behind the Colorbo...

Calling a .php file in the onclick() event.

I want to call a .php file from the OnClick event. <input id="Edit" name="Edit" value="Edit Record" type="button" onclick="---call to php file----;" /> The code is show above. I want to call a .php file through Javascript and pass a cookie value in the query string. ...

How can we send data back to Controller action from Javascript

I have a modal dialog box which would open onclick of a link in the page. From the js now i would need to send some values to the Controller. But I cannt use form from where I can submit those values back to controller. Are there any other way of doing this or am I talking insane?? ...

Prototype best practice for "click anywhere to close"?

I find myself very often in the situation that I open an element in a web page - e.g. a drop-down menu - that I want to close if the user clicks anywhere on the page except the element itself. To keep things simple, I have mostly written the code myself instead of employing some drop-down menu class. However, I have never managed to b...

asp button and history back onclientclick

hi I have an asp button like this <asp:Button ID="btnBack" OnClientClick='javascript:history.back()' runat="server" Text="back"> </asp:Button> now the javascript doesn't work to go a history back. but if I make an alert() it works...why how to solve this? thank you ...

JavaScript function compatible problem needs your help

<ul id="MarqueePro2"></ul> </ul> <script> var speed=60; var MarqueePro=document.getElementById("MarqueePro"); var MarqueePro2=document.getElementById("MarqueePro2"); var MarqueePro1=document.getElementById("MarqueePro1"); MarqueePro2.innerHTML=MarqueePro1.innerHTML; function Marquee() { if(MarqueePro2.of...

jquery fill glass effect

I'm looking for a jqeury or javascript that fill up a glass of water. So when clicking on one button you add water to the glass and when clicking on another you remove water from the glass. Just wonder if someone already have written something like this that I can use. Thanks! ...

inserting javascript in xslt not working in safari

Hi, I have a page that is pulling in an xml file uisng xslt. I need to add some javascript to it and have managed to get it all working in IE and FF but Safari is a no no. Here is the code I am using: <SCRIPT LANGUAGE="javascript" DEFER="true"> <xsl:text disable-output-escaping="yes"> <![CDATA[ javascript here ]]> </xsl:te...

writing more efficient code in javascript

Hi all, I'm trying to write more readable and more efficient code, I've always hated if if if chains .. is it possible to write the following statement in some other more "elegant" way like maybe using ternary ops : if(text.length < 1){ if(errtext.length > 1){ errtext+="<br>"; } errors = true; errtext += "Field cannot be emp...

pure javascript equivalent of jquery $("#large_box2_link").click();

I use this small code within a jquery function, it works in every browser apart from ie6 and it just so happens our client only uses ie6, Can anyone help me translate this into pure javascript? $("#large_box2_link").click(); ...

Scriptaculous two toggles at once

How can I toggle an element to blind and fade at once? I tried the code Event.observe(window,'load',function() { Event.observe($("delete"),'click',function() { Effect.toggle("entry","appear",{ duration: 2.0 }); Effect.toggle("entry","blind",{ duration: 2.5 }); }); }); One will run, but not both. ...

JQuery Validation with Select and Text Input

I'm having one heck of a time getting this validation to work. I'm using the JQuery Validation framework found here, and I'm trying to validate a form that has both a select and an input as required fields. I've managed to simplify the problem down to a rather simple prototype that demonstrates the problem: <%@ Page Language="C#" Au...

Link in one div, trying to load content in a seperate div

Hello, I am using jQuery to make a website, and I want to be able to have my navigation in a separate div from my content. Also, I want to be able to have a sort of tabbed navigation system such that I can click a link in the navigation and it will load the content into the main content div. Basically, I want to do this so that I can jus...

What would be a good way to direct users to different URLs from one link?

I've been working with PHP for a few months now. I've put together a small PHP site with three groups of users: admin, teacher, students. Here's what I would like to do: Students are in different groups. I have five different groups now. Each one of these five groups has access to a link that directs them to an online classroom. We can...

Javascript: Call function, pass array of arguments, similar to setTimout()'s functionality.

I want to do what setTimout does, manually, with no timeout. setTimeout(function,0,args); Just call a function and pass it an array of arguments, without knowing or caring how many arguments were there. Basically I want to proxy the function call through another function. I'm bad with terminology, sorry. ...

ASP.NET MVC and Relative Paths within Javascript

This question is being based off of a similar question titled, "ASP.NET MVC Relative Paths", located here. I understand that issues arise concerning absolute and relative paths when developing an ASP.NET application...especially an ASP.NET MVC application. Throughout the application lifecycle, I've been using something similar to the fo...

Programmatically toggle a jquery treeview item?

Hey, I have a jquery treeview as navigation for a website. I am using the options: unique:true, collapsed:true but I need to have the first item expanded. I also would like to be able to toggle states in certain functions. How can i programmatically toggle a jquery treeview item? I have read the documentation and searched everywher...

Stop javascript onclick 'page jumping'

Can't seem to prevent the jump to top of page behavior. I've tried everything suggested here http://stackoverflow.com/questions/1631924/preventing-onclick-page-jumps What else could be done to stop onclick page jumps? Thanks. Here's a snippet of the HTML and JS HTML: <a href="javascript: return null;" onclick='javascript:getPosts("...