background preloader

Javascript

Facebook Twitter

JavaScript FAQ, quizzes, games, and more.

API JS

JSON Editor Online - view, edit and format JSON online. RegExp. L'éditeur JavaScript - AJAX. Create HTML5 Canvas Drawing Board Within 5 Minutes! Welcome to “Create HTML5 Canvas Drawing Board Within 5 Minutes!” Tutorial. We are going to create a drawing board using HTML5 Canvas API.

This is an easy to follow tutorial, and I’ll try not to lose anyone, though, I promise. If you’re not entirely sure what HTML5 Canvas is, please read HTML5 Canvas For Absolute Beginners, before you continuing this tutorial. Please check out the demo before we start our tutorial. View Demo HTML Structure Ok, let’s start our tutorial by creating a div named “board” which will contains a canvas element and a color picker dropdown box. CSS Styles The CSS for this tutorial is simple and easy, following is how the CSS codes looks like: First of all, we have to offset the body’s margin; horizontally center the div with named “board”; and apply 3px width of border to the canvas element.

The JavaScript Here is the section where we convert our canvas into a drawing board. Next, we will have a window.onload event to executes all the codes when the window has loaded. Sylvester. L'XMLHttpRequest cross-domain - Javascript. Utilisation de jQuery.ajax() - Syrinxoon Tuts. Suite à la demande d'un visiteur du site, je vais vous expliquer tout au long de ce tutoriel comment fonctionne la fonction jQuery.ajax() du framework jQuery et comment vous en servir. Nous commencerons par l'aspect théorique à la base d'AJAX, à savoir, l'objet Javascript XMLHttpRequest. Si la théorie ne vous intéresse pas et que vous souhaitez passer tout de suite à la pratique, aucun problème, vous pouvez passer ce chapitre, je ne vous en voudrais pas, promis.

Definition AJAX signifie Asynchronous Javascript And XML (Javascript et XML Asynchrone). Je ne serais pas contre le fait de remplacer XML par JSON qui est de plus en plus utilisé. On en reparlera plus loin. Javascript et XML, okay, je vois, mais asynchrone, c'est quoi ça ? XMLHttpRequest XMLHttpRequest est un object Javascript implémenté dans tous les navigateurs actuels (je considère que votre navigateur est à jour, vous n'êtes pas des noobs quand même).

La théorie est maintenant terminée, passons à la pratique. <? <? Get OpenTok JavaScript API tutorials and sample code | OpenTok. Play HTML5 audio in the browser | Tutorial. Google JavaScript Style Guide. We follow the C++ formatting rules in spirit, with the following additional clarifications. Curly Braces Because of implicit semicolon insertion, always start your curly braces on the same line as whatever they're opening. For example: if (something) { // ... } else { // ... } Array and Object Initializers Single-line array and object initializers are allowed when they fit on a line: Multiline array initializers and object initializers are indented 2 spaces, with the braces on their own line, just like blocks. Long identifiers or values present problems for aligned initialization lists, so always prefer non-aligned initialization. Not like this: Function Arguments When possible, all function arguments should be listed on the same line. // Four-space, wrap at 80.

When the function call is itself indented, you're free to start the 4-space indent relative to the beginning of the original statement or relative to the beginning of the current function call. Passing Anonymous Functions Blank lines. JS: The Right Way. JavaScript Fundamentals: Variables. I have never heard of a language that doesn't use variables, and JavaScript is definitely not an exception to that. Variables are handled differently in each language and to become a true JavaScript expert you'll need to understand how JavaScript handles variables too.

For the most part it's very straightforward, but there are plenty of "gotchas" you'll want to be aware of. Declaring a Variable The first thing that you'll probably want to know about JavaScript variables is that they are loosely typed. This means a couple things: You don't need to set the type of a variable when you declare the variable.You can change the value of a variable to a different type at any time.

Instead of saying what type of variable it will be, you simply use the var keyword when you declare a variable. In the first line where variableName was declared without a value, it will be undefined. Determining Type Here are all the different results you can get from using typeof: Scope Pointers and Mutability Conclusion. JavaScript reference. JavaScript is a scripting language primarily used in Web applications. It allows authors to create dynamic HTML (DHTML) pages. The JavaScript language has three components: Core JavaScript is the base part of the JavaScript language that is supported on both the client and server side. Client-side JavaScript (CSJS) contains the core JavaScript elements and has several additional objects, properties and methods that are supported by browsers.

Dottoro provides you a complete standard and browser specific Core and Client-side JavaScript reference with detailed descriptions, syntax, examples, browser support information, cross-browser solutions and much more. JavaScript is primarily used for event handling, form validation, DOM and style manipulation, browser detection, animation and more. Unfortunately, client side scripting has a drawback; sometimes different browsers support different language elements. Contents: External links: JavaScript. Skill Level Indicator by apovtx. Welcome to Skill Level Indicator's GitHub Page. Skill Level Indicator is a javascript function that helps you create nice and highly customizable rounded skill indicators. It's usage is very simple. It only requires a browser that supports the html5 canvas element.

See it in action: Usage After including the script in your page you only have to just call it with 1 mandatory argument and some optional changes you may want. To include it in your page you just need to have: and to create a skill indicator: And that's all! Options You can customize the output with many different options: ToDo There are many things that are in the ToDo list! Create the canvas element automatically (will be in JQuery plugin version)Change the font-family of the textFallback for browsers that don't support canvasCalculate the text size depending on the radius and name length (done) A Step-by-Step Tutorial of Building a Simple Peer-to-Peer WebSocket App – Part 1 | The Zinger. This tutorial series walks you through the simple steps of building an HTML5 WebSocket app, demonstrating the power of the publish/subscribe development pattern directly in JavaScript. Our sample is almost as simple as a Chat app, the “Hello World” app of the WebSocket world, but is a tad more visual and dynamic.

After trying out the completed application, you can either jump in the code and play with it right away, or move on to Part 2 of this tutorial for a step-by-step guide. About the Environment This tutorial requires a WebSocket server. We will use which hosts the JMS Edition of Kaazing WebSocket Gateway, Kaazing’s high-performance enterprise-grade WebSocket Server. All you’ll need to do is create a WebSocket connection to this server directly from your browser and start “talking” (read: send messages) to it from your browser.

Getting Started Firstly, to understand how the tutorial environment in JSFiddle works, open up the completed demo in JSFiddle.

Framework

390 ressources Javascript & jQuery. Learn to code.