background preloader

Javascript

Facebook Twitter

OpenLayers

jQuery File Upload Demo. Contents -- Eloquent JavaScript. A (Re)-Introduction to JavaScript - slide 001. JavaScript Object-Oriented Programming Part 2 [JavaScript &amp; AJAX Tutorials] In Part 1 of this series, we covered objects, object methods, and object categories. Now, let’s move on. Arguments In every function, a private variable — argument — is automatically created, holding an array of the arguments passed to the function. For example: function testArg(){ for(i=0;i<arguments.length;i++){ alert("Argument "+i+" is "+arguments[i]); } } As demonstrated in the example above, we can access the set of arguments passed when calling a function with the arguments variable that exists in the function’s scope.

Therefore, we can use: testArg("PageResource","SitePoint","JavaScriptCity", "WebSite Abstraction"); …to get an alert of some of my favorite Web development sites. Complex Example Now that we have a foundation in object-based programming in JavaScript, let’s build an intricate object-based example, a library. Function Person(lastName, firstName){ this.lastName = lastName; this.firstName = firstName; } And now, let’s create some instances of our Person object:

JavaScript Object-Oriented Programming Part 1 [JavaScript &amp; AJAX Tutorials] This article was written in 2001 and still remains one of our most popular posts. If you’re keen to learn more about JavaScript, you may find this recent article on TypeScript of great interest. It may be shocking news, but JavaScript is a very powerful object-based (or prototype-based, whatever you wish to call it) language. Yes, JavaScript is a powerful language, not just something that’s handy for image rollovers and other corny, flashy effects. However, very few people who have used JavaScript realize its capabilities.

If you’re one of these people, this tutorial is aimed at you. First of all, JavaScript is not a full-blown OOP (Object-Oriented Programming) language, such as Java or PHP, but it is an object-based language. So, why should you use objects? I hope that this article will turn an intermediate JavaScripter who’s itching to learn objects, into an expert, keen on the exciting object-oriented JavaScript world! In this tutorial, you’ll learn: JavaScript’s Primitive Data Types. Labs - GreyBox. A pop-up window that doesn't suck. Introduction GreyBox can be used to display websites, images and other content in a beautiful way. Why use GreyBox: It does not conflict with pop-up blockers It's only 22 KB! It's super easy to setup It's super easy to use You can easily alter the style as it is controlled through CSS Examples One website To trigger GreyBox you'll only need to append a rel tag on your a tags: <a href=" title="Google" rel="gb_page_fs[]">Launch google.com in fullscreen window</a> Website gallery Image gallery It takes very little code to display image galleries: Installation Step 1 Append following to your header section.

<script type="text/javascript"> var GB_ROOT_DIR = " GB_ROOT_DIR should be absolute. Step 2 Append also following scripts and one stylesheet: AJS_fx.js is optional. Step 3 You are ready to use GreyBox. Where could it be used? What browsers are supported? Safari Firefox 1.5+ Internet Explorer 5.5+ Opera 8.5+ Steve Kallestad: Compacting Prototype.js and Scriptaculous. Moo.fx - the next small thing. Using prototype.js v1.4.0. Last update: August 18th 2007 Table of Contents What is that? In case you haven't already used it, prototype.js is a JavaScript library initially written by Sam Stephenson. This amazingly well thought and well written piece of standards-compliant code takes a lot of the burden associated with creating rich, highly interactive web pages that characterize the Web 2.0 off your back.

When I first started trying to use this library, a few years ago, I noticed that the documentation was definitely not one of its strongest points. As many other developers before me, I got my head around prototype.js by reading the source code and experimenting with it. I'm also offering an un-official reference for the objects, classes, functions, and extensions provided by this library. As you read the examples and the reference, developers familiar with the Ruby programming language will notice an intentional similarity between Ruby's built-in classes and many of the extensions implemented by this library.

Toc <? Prototype JavaScript Framework: Class-style OO, Ajax, and more.