background preloader

Javascript

Facebook Twitter

NsIJSON - MDC. This interface provides a convenient way to encode and decode JSON strings from JavaScript code.

nsIJSON - MDC

Introduced Gecko 1.9 Inherits from: nsISupportsLast changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Implemented by: @mozilla.org/dom/json;1. Eclipse 3.6 Install PDT, JavaScript, CDT, Ruby, MarketPlace Plugins. Firefox Plugin. UTF-8 Converter //JavaScript Object [javascript] [utf8] [convert] [conversion] [decode] [jonas] [encode] [charset] [ascii] [utf] [decoder] [encoder] [ansi] [jsfromhell] [raoni]

| 54561 views | 0inShare <a href=" Converts a sequence of ANSI characters to UTF-8 and vice-versa.

UTF-8 Converter //JavaScript Object [javascript] [utf8] [convert] [conversion] [decode] [jonas] [encode] [charset] [ascii] [utf] [decoder] [encoder] [ansi] [jsfromhell] [raoni]

[UPDATED CODE AND HELP CAN BE FOUND HERE] </a> 05. encode: function(s){ 06. for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l; JavaScript fromCharCode() Method. Javascript UTF-8 - Javascript tutorial with example source code. XMLHttpRequest - MDC. Use XMLHttpRequest (XHR) objects to interact with servers.

XMLHttpRequest - MDC

You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XMLHttpRequest is used heavily in Ajax programming. Despite its name, XMLHttpRequest can be used to retrieve any type of data, not just XML, and it supports protocols other than HTTP (including file and ftp).

If your communication needs involve receiving event or message data from the server, consider using server-sent events through the EventSource interface. Constructor XMLHttpRequest() URL Decoder/Encoder. URL Decoder/Encoder Input a string of text and encode or decode it as you like.Handy for turning encoded JavaScript URLs from complete gibberish into readable gibberish.If you'd like to have the URL Decoder/Encoder for offline use, just view source and save to your hard drive. The URL Decoder/Encoder is licensed under a Creative Commons Attribution-ShareAlike 2.0 License. This tool is provided without warranty, guarantee, or much in the way of explanation. Note that use of this tool may or may not crash your browser, lock up your machine, erase your hard drive, or e-mail those naughty pictures you hid in the Utilities folder to your mother. Don't blame me if anything bad happens to you, because it's actually the aliens' fault.

Regular Expressions sample usage. Sample Usage Now that you’ve been introduced to regular expressions and patterns, let’s look at a few examples of common validation and formatting functions. - Valid Number A valid number value should contain only an optional minus sign, followed by digits, followed by an optional dot (.) to signal decimals, and if it's present, additional digits.

Regular Expressions sample usage

Regular Expressions: Defining a Regular Expression - Doc JavaScript. JavaScript Regular Expressions Defining a Regular Expression (JavaScript) One way to define a regular expression is to simply assign it to a variable: var varName = /PATTERN/[g|i|gi]; Here's an example: var child = /(Bart|Lisa|Maggie) Simpson/i;

Regular Expressions: Defining a Regular Expression - Doc JavaScript

JavaScript Regular Expressions patterns. Useful CSS shorthand properties. Useful CSS shorthand properties One of the main advantages of using CSS is the large reduction in web page download time.

Useful CSS shorthand properties

To style text, you used to have to use the <font> tag over and over again. You probably also laid out your site with tables, nested tables and spacer gifs. Now all that presentational information can be placed in one CSS document, with each command listed just once. A canvas clearRect example. How to empty the canvas? how to change the image in canvas? - google-excanvas. Introduction to Events. Page last changed today See section 7A of the book.

Introduction to Events

Events are supported by all JavaScript browsers except for Explorer 3 on Mac. Omniweb 4.2 and lower have meager event support. Events are the beating heart of any JavaScript application. On this page I give an overview of what event handling is, what its problems are and how to write proper cross-browser scripts. Page Events. Introduction If you place Javascript code into the head section of your page outside of functions then that Javascript will run before the web page content is loaded.

Page Events

If you place Javascript code outside of functions in the body section of your web page then that Javascript will run as the page is loading (when the loading of the page reaches the code). In both of these instances the entire web page will not have been loaded - particularly if the page contains lots of images. We can get Javascripts to run after the page has finished loading and even when the page is unloaded (by your visitor requesting another page) by attaching event handlers to the body tag itself. API: element Element.js (YUI Library) JavaScript Button Object. 'fileSize' Example : fileSize « Javascript Properties « JavaScript Reference. JavaScript Two Dimensional Arrays. JavaScript Two Dimensional Arrays In this JavaScript tutorial you will learn about two dimensional arrays - how to define and access two dimensional array in JavaScript.

JavaScript Two Dimensional Arrays

Two Dimensional Arrays in JavaScript: Two Dimensional Arrays are storing elements in a structure similar to that of a table. Some Simple JavaScript Functions. Monday, December 06, 2004 Some Simple JavaScript Functions by Mitchell Harper. How to convert decimal to hex in JavaScript. Javascript Basics Part 11 - www.htmlgoodies.com. You have written a JavaScript application and it's working fine--until you get an error message.

Javascript Basics Part 11 - www.htmlgoodies.com

It's something unsightly that pops up on your screen, something like 'myObject.fields is null or not an object'. What on earth does this mean? The JavaScript Diaries: Part 13 - www.htmlgoodies.com. Now that we know about the different types of arrays, we'll learn how to manipulate them in order to make them more functional. In this section, we'll look at the properties and methods that are commonly used for most coding situations.

Array Properties length The length property returns the number of elements in an array. The format is arrayName.length. JavaScript Error Handling: Page 2 - ChunkySoup.net. Originally Published 2001-12-15 :: Last Modified 2003-10-02 Doing Something Else With The Error Those familiar with JavaScript may already see how we can build in custom handling of the error after looking at the above example. What I have done is create a function called handleError() and set it to run each time an error occurs in the page. This function is no different then any other JavaScript function in that you can program it to do anything you'd like. While it is possible to move layers around, rewrite the whole document, or spawn 50 popup windows, I'd lean towards something simple and not prone to syntax errors or browser failings. <! Although we've now replaced the browsers handling of the error with our own the alert message really doesn't help much.

Failing Gracefully With an Error Document My favorite way to deal with an incapacitated page is to redirect the visitor to a friendly error message reminiscent of a 404 response. <! Finding and Fixing The Error Why Bother? Conclusion. JavaScript Kit- Image Object. Last updated: March 17th, 2005. Global Variables in JavaScript. Global and local variables in javascript functions - understandi. JavaScript functions help us divided our script into discrete chunks of code. Functions contain blocks of statements that can be regarded as separate entities from the main script because they are only executed when the function is called. What are Local and Global variables?

When a function is defined certain variables used for storing values are incorporated inside the function. These variables are found and used only inside these functions. Since functions are separate from the main code, it's advisable to use variables that are initialized only when a function is called and die when the execution comes out of the function. What is "variable scope"? Local variables exist only inside a particular function hence they have Local Scope. How to initialize a Local variable? Any variable that is initialized inside a function using the var keyword will have a local scope.

We first declare a global variable a and assign it a value of 10. XUL/JavaScript: Open new window and set content in window. Finding open tabs of reuse with delayedOpenTab (solved-fyi)