javascript

MooTools: Parsing Ajax responseTree

I have an Ajax request to an XML document. The XML document is an RSS feed. Here's my onSuccess for the request: onSuccess: function(responseTree) { // process <item> elements } How do I enumerate <item> elements and retrieve the various child values? ...

Unusual javascript HTTP caching / undefined issues

Ok. I have never seen anything like this before and I am quite confused... On a website I am working on, there are two JavaScript includes. (Well, many more, but the problem occurs with only two). We'll call these A.js and B.js. A.js defines a JavaScript singleton A. Likewise B.js defines a JavaScript singleton B. The B class depends on...

post data to iframe on javascript load for widget

I have a little widget which has quite a few customizable options. The widget is currently retrieved by a combination of javascript creating an iframe, and the iframe contains a bunch of javascript and jquery to build the page. I can't add the complexity of conflicting javascript to the embed page, that is why i build an iframe, and ru...

How to copy the value of a reference in javascript?

Some time ago I posted a question about what questions should a good javascript coder be able to answer. Meder pointed out the following question: The following code makes clicks on any "a" element to alert(-1) due to the fact that "i" is hold in the onclick function as a reference and not as a value: <a href="#">text</a><br><a href="...

Variable scope with JQuery

I have a Javascript object which has a jquery ajax call to server to fill one of its attributes: function Busqueda(contenedor){ var datosPost = "someData"; var resultados = undefined; var that = this; this.buscar = function(){ jQuery.ajax({ type: "POST", dataType: "json", ur...

Javascript Performance - Dom Reflow - Google Article

Could someone prove to me that the advice given here (copied below) regarding removing dom elements before altering them and then re-inserting them is ever quicker. By prove, I would like to see some figures. Its great that they research this but I think the article is very weak without including specifics as to what the 'problem' actu...

"this" keyword in IE

So, I using this snippet <tr onclick="this.toggleClassName('selected')"> on a web page. (a Prototype.js function) It works great. All I do is click on a table row, and it appears to get selected. It works everywhere, except IE and Opera. This is just a convenience, so I don't really care if it works, but in IE it throws an error, and a...

Netbeans Module not being deployed

Original Question Title: C:\Documents and Settings\user\My Documents\NetBeansProjects\ConsultingAgency\nbproject\build-impl.xml:563: The module has not been deployed. hello I am new to javaserver face developing and following some netbean tutorials on this Generating a JavaServer Faces CRUD Application from a Database : http://net...

basic JavaScript issue with childNodes

Hi! I'm a JS beginner. I posted this question because I've been trying to find a solution for 2 hours (it's 3:00am and I'm dying to go to bed). So thanks for understanding. I want to get the child node of the tagname div. Then alert the name (txtPhone). <div class="formfield"> <input id="txtPhone" name="txtPhone" /> So: alert(docu...

How to disable click with jQuery/JavaScript?

I have a link that I would like to present with a confirmation. I am using the javascript confirm() method. But the only way for me to get the link to not work when the user clicks 'cancel' is to use return false;. Is that the correct way to do it (cross-browser)? $('a.confirm').click(function() { if(confirm('Are you sure? This cann...

Javascript Toggling

Hiya, I'm trying to get a toggle effect but not quite sure how to do it or what to look for. (i jave Jquery loaded). assume html similar to <table class="left-dates"> <tr><td>All Dates</td></tr> <tr><td>01 dec 2009</td></tr> <tr><td>02 dec 2009</td></tr> <tr><td>03 dec 2009</td></tr> <tr><td>04 dec 2009</td></tr>...

jquery, how to animate element after being sure that it's not being animated at the same time

$("sth").not(':animated').animate(); hey is this the best way to animate element after being sure that it's not being animated at the same moment ? thanks ...

Intercepting call to the back button in my AJAX application: I don't want it to do anything!

I have an AJAX app. A user clicks a button, and the page's display changes. They click the back button, expecting to go to the original state, but instead, they go to the previous page in their browser. How can I intercept and re-assign the back button event? I've looked into libraries like RSH (which I couldn't get to work...), and I'...

Prototype + Scriptaculous: Migration Questions

We are using Prototype 1.5.1.1 along with Scriptaculous version 1.7.1. Tried upgrading to Prototype 1.6 branch (along with 1.8 branch of Scriptaculous), but seems some things must have changed - more than a few things do not work when we point our files to include the new versions (firebug is throwing all kinds of exceptions). I don't ...

Implementing a "change" Event for Typical Element Nodes using jQuery

I would really like a way to observe changes to a node and trigger functions based on those changes. I'm going to define "changes" as: Attribute edits/additions/deletions to a node and all descendants. Text node edits/additions/deletions inside a node and all descendants. Events bound/unbound to a node and all descendents. The additio...

javascript/dashcode: check for internet connection

i'm developing a widget that is fetching data from the internet via ajax and i want to provide a error message, if the widget cannot connect to the server. i'm doing the request with jquery's ajax object which provides a error callback function, but it's not called when there is no internet connection, only if the request is made but fai...

CKEditor: Class or ID for editor body

I have an instance of CKEditor on a page. I am trying to give the CKEditor's body a class or ID so it matches some styles I have defined in a stylesheet. There is a API documentation that should give access to the respective DOM elements, but I can't seem to get it working. All objects I try to query that way turn out undefined. Does a...

What's the easiest way to pass image data from the client side to a mozilla plugin

I have a Zebra label printer on an XP box which I want to drive with JS in a FireFox browser. Currently I have a plugin based on the npscriptable geko sdk sample. I pass strings in using JS string property sets, and the plugin renders the strings: <form> <input type="button" value=" Print Label " onclick="doPrint();return false;" /> ...

Jstestdriver setup and teardown

Hi all: Does anyone know the syntax for setUp and tearDown functions/methods for JsTestdriver? On their website they claim to be able to define it, but I can't get it right. Thanks. ...

How do you use javascript/jQuery to rewrite amazon affiliate links?

Basically what I want the script to do, is add my affiliate ID to all Amazon links posted by my users.(Kinda what SO is doing, minus the whole redirect/racking thing) Here is the code I'm using, and for some reason it's not working. <script type="text/javascript"> $(document).ready(function() { $('a[href*='amazon.com']').each(...