Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVASCRIPT


  Removing all child nodes from an element

When manipulating the DOM, it's often useful to remove all child nodes from a specific element. This typically comes in handy when you're looking to replace the content of an element with a separate form element, such as an <input>, so the user can edit the actual value.Here's an example of something I recently created that illustrates my point:Get the Flash Player to see this player.These "dynamic form elements" are written to the page only when the user performs a certain action; in this case: clicking on a table cell.The HTML for the table cell ...

3,147 0       JS DOM REMOVE ALL CHILDREN CLEAR JAVASCRIPT CODE


  JavaScript Attack/Defend

As developers and designers we work hard to build visually attractive, fast and easy to maintain applications. Our goals are to make sure the applications we build stick to users and keep them coming back for more. Security is not always at the forefront of our minds. No one intentionally builds insecure software but often a lack of security knowledge leads developers to build vulnerabilities into their applications. In this article we are going to examine two web security attacks, how they are executed and how to defend against them. By the end of this article you will have a few techniques i...

3,977 0       SECURITY JAVASCRIPT ATTACK DEFEND CROSS SITE


  passing parameters to XMLHttpRequest’s onreadystatechange function

I’ve been smashing my head against this all day – but I finally got something working consistently and reliable, so I better damn well document it. This is as good a place as any, and hopefully it will be useful to others.I needed to make an Ajax call, so I turned to my good friend XMLHttpRequest. One wrinkle was that I needed to pass in a parameter to it… so I tried:var test = "bar";req = new XMLHttpRequest();req.open("GET", myURL, true);req.foo = test;req.onreadystatechange = function() { if (this.readyState != 4) return; if (this.status == 200) { aler...

13,213 1       AJAX JAVASCRIPT XMLHTTPREQUEST PARAMETER ONREADYSTATECHANGE


  Introducing Google JS Test

Google JS Test is a JavaScript unit testing framework that runs on the V8 JavaScript Engine, the same open source project that is responsible for Google Chrome’s super-fast JS execution speed. Google JS Test is used internally by several Google projects, and we’re pleased to announce that it has been released as an open source project.Features of Google JS Test include:Extremely fast startup and execution time, without needing to run a browser.Clean, readable output in the case of both passing and failing tests.An optional browser-based test runner that can simply be re...

2,941 0       GOOGLE JAVASCRIPT TEST TOOL OPEN SOURCE


  Learning Server-Side JavaScript with Node.js

Node.js is all the buzz at the moment, and makes creating high performance, real-time web applications easy. It allows JavaScript to be used end to end, both on the server and on the client. This tutorial will walk you through the installation of Node and your first “Hello World” program, to building a scalable streaming Twitter server.What is Node.js?JavaScript has traditionally only run in the web browser, but recently there has been considerable interest in bringing it to the server side as well, thanks to the CommonJS project. Other server-side JavaScript environments...

2,560 0       JAVASCRIPT SERVER SIDE NODE.JS.IMPLEMENT


  JavaScript delete specific item from array

Deleting an item from an array is easy using JavaScript’s built-in method splice(). However, if you are somewhat new to scripting, simply knowing about splice does not help you remove a certain item from an array. This article will solidly state the solution to this dilemma.If you want to remove a specific item from your array, you will simply use a basic loop and a conditional check with the splice()method.Here is a breakdown of what we will do in 3 easy steps, so that you can implement this solution yourself later.The Three Step ProcessSetup a basic ‘forâ€...

4,693 0       JAVASCRIPT ARRAY SPLICE REMOVE ITEM DELE


  IE ActiveX(”htmlfile”) Transport, Part II

In my last post I discussed using the ActiveX(”htmlfile”) technique to provide a usable streaming transport in Internet Explorer. The solution I provided will work, but since writing the last article I’ve made significant progress in understanding why IE behaves the way it does with respect to the streaming transport.The previous solution amounted to creating an array of messages, pushing messages on that array from the htmlfile iframe, and popping messages off of the array in the parent window, and processing them. Here is the function we use to create that solution:functio...

4,879 0       IE STREAMING HTMLFILE HTTP TRANSPORT ACT


  HTTP Streaming and Internet Explorer

In early 2006, Alex Russell posted about a neat hack that the Google Talk team in Gmail use to support Comet in Internet Explorer, a trick which works as far back as IE 5.01. What great news! A reliable way to stream Comet messages to Microsoft’s browsers. If only it were that easy.I have not been alone in the following findings: after connecting the htmlfile ActiveX object as a streaming Comet transport to my Comet server, everything works perfectly for a few messages, but then abruptly fails. The connection is closed by the browser with the server-side error “Connection reset by...

24,561 0       JAVASCRIPT IE STREAMING HTMLFILE ACTIVEX