background preloader

Javascript and jQuery

Facebook Twitter

Submit Form without Refreshing Page with Jquery. This post helps you to submit your form without refreshing page. In this tutorial I will show you how simple it is to do using jQuery form plugin just five lines of JavaScript code, no need to post data string values via ajax. Explained collaboration with validate plugin for implementing form field validations. Download Script Live Demo JavaScript Code$("#form").ajaxForm()- form is the ID name of the FORM tag. Contact.html Simple HTML code. <div id="preview"></div><div id="formbox"> <form id="form" action="submit.php" method="post"> Name<input type="text" name="name" /> Email<input type="text" name="email" /> Message<textarea name="message"></textarea><input type="submit" value="Submit"></form></div> Contacts Table contains name, email, message and created data etc.

CREATE TABLE `contact` ( `id` int(11) AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) UNIQUE KEY, `email` varchar(100), `message` text UNIQUE KEY, `created_date` int(11), ) submit.php Contails simple PHP code. <? Validate Plugin. FdW Talent n°2 - Require.js: Optimisez le chargement de vos JS. Pour la 2ème découverte des Fermiers du Web ont du talent, je vous présente Require.js, une librairie Javascript permettant d'optimiser le chargement des fichiers Javascript de vos pages web.

L'heure est à l'optimisation de ses performances web et temps de réponse. Notamment depuis que Google prend en compte ces métriques de temps de chargement dans son algo. Jérémy Barbe alias Capitaine Mousse, a développé Require.js pour mieux répondre à ses besoins, les solutions existantes ne convenant pas. Require.js permet de charger de manière optimisée (toujours pour des gains en performances web) les différents fichier Javascript ou fonctions JS à insérer dans votre page.

Son utilisation est très simple: 1.require([ 2. 3. 4. 5.], function(){ 6. alert('files loaded'); La fonction require prend en paramètre un tableau avec la liste des javascript à insérer, dans l'ordre souhaité, avec les fonctions d'initialisation si besoin. Site Officiel. JavaScript RegExp Object. Juiz Slicing Door in jQuery - CreativeJuiz. Mozilla Firefox.

Demos - Uploadify. Formly - Style et validation sur vos formulaires HTML avec jQuery. Formly est un plugin jQuery permettant de donner du style à vos formulaires et ajouter une couche de validation Javascript avant la soumission du formulaire. Les formulaires HTML de base ne sont pas très design ... grâce à Formly vous aurez la possibilité de donner du style aux input, checkbox, radio ... en quelques lignes de code ! En effet, la librairie dispose d'un système de thème permettant de donner un style plutôt sympa à vos formulaires. Par défaut, il existe un thème light et un thème dark. A vous de décider de la forme à donner à votre formulaire, son style sera automatiquement appliqué. Deuxième point, le système de validation Javascript des champs, paramètrable directement dans le HTML du formulaire grâce aux propriétés validate, required ... Voici un exemple d'utilisation: 1. 2. 3. 4. 5. 6. 7. 8. Et le jQuery pour instancier le plugin: 1. Plutôt pratique comme plugin, reste à créer ses propres thèmes pour coller au mieux avec son site.

Site Officiel. Demo - Vegas Background jQuery Plugin | Webdesign code. Agile Carousel - Javascript Slideshow - Image Carousel. Edtalmadge/Agile-Carousel - GitHub. /packer/ Mozilla Firefox. Programmation orientée objet avec le langage JavaScript (1ère partie) Dans ce premier article, nous allons décrire les différents mécanismes de base du noyau du langage JavaScript, le langage EcmaScript. Ce dernier est standardisé par la spécification ECMA-262 [1] dont la version 3 est la version courante. Bien que ce langage soit orienté objet, il différe considérablement des langages objet classiques tels que Java et C++ puisqu'il se fonde sur une variante de ce paradigme, à savoir la programmation orientée objet par prototype [2]. Nous verrons que son intérêt consiste en son aspect dynamique permettant de modifier la structure des objets après leur création.

La plupart des concepts de la programmation orientée objet peuvent être mis en oeuvre mais des limitations existent néanmoins avec ce type de programmation orientée objet. La connaissance des différents mécanismes de base de JavaScript est primordiale à différents niveaux. Avant de rentrer dans le vif du sujet, commençons par rappeller ce qu'est le langage JavaScript et ce qu'il permet de faire. 0.1. Get Started With Prototype. Much of the web counts on JavaScript for its interactivity and for many years it was difficult to write. Browser inconsistencies and complicated code made even advanced coders grimace. JavaScript frameworks, such as Prototype, jQuery and MooTools have taken much of the pain away. These frameworks sit on top of JavaScript and make common tasks a whole lot easier.

Prototype is the granddaddy of JavaScript frameworks. It was the first to gain wide popularity, probably due to its pairing with the Ruby on Rails server-side programming framework. In this tutorial, I’ll provide an introduction to the Prototype way of writing JavaScript. We’ll find objects on the page in various ways and manipulate them. Let’s get started learning Prototype and writing shorter, hassle-free JavaScript. What You Need Knowledge of HTML and CSS Basic JavaScript experience A copy of the Prototype source file. Start With Some HTML Opened in a browser, the above is blank. Another note about scripts. Find Your Elements. The stupidly brief – how to use Prototype’s insert() function « Bobobobo’s Weblog. I think the prototype docs are too brief. Stupidly brief, in fact. Don’t get me wrong. The docs are generally well formatted and pretty complete. But when it wastes more than a couple of minutes of my time to figure out how to use a specific function, its just a little too brief.

Stupidly brief. Its stupidly brief because someone who already knows how to use it won’t need to refer to it, and someone who doesn’t won’t be able to understand it very quickly without being confused. Element.insert Yes, yes they beat msdn hands down by using clever looking uri’s like An example please?

Sheesh. How to add to the dom using prototype. The problem with the docs is they’re not mentioning that there’s two classes of functions. This brief example illustrates the difference. Like this: Like Loading... Prototype.js : Ajax.Request.CONSTRUCTOR()-2 - le-developpeur-web.com. Paramètres : Ajax.Request(url[,{options}]) Rôle : crée une requête ajax Retourne : objet ajax Note : Attention ! Si le fichier "prototype.js" est chargé sur le nom de domaine "monsite1.com", l'objet Ajax ne pourra faire appel qu'à des fichiers situé sur le même nom de domaine !!!

Options : asynchronous:true | false Définit si la requête doit être gérée de manière synchrone ou asynchrone. De façon synchrone, le script va rester bloqué jusqu'à ce que la réponse arrive. On créé un objet Ajax, on appel l'url "flux01.php" et affiche le flux retourné par le fichier "flux01.php". Create a new Fiddle - jsFiddle - Online Editor for the Web (JavaScript, MooTools, jQuery, Prototype, YUI, Glow and Dojo, HTML, CSS)

Javascript Objects - A Useful Example. Today, we are going to take a look at how to work with simple (and not so simple) javascript objects. The javascript object is a very misunderstood beast - quite often people don't even know that javascript has objects. And of the people who do know about them, many think that it is a stripped down and weak object system, and so never bother to actually use it when writing any javascript. But actually the opposite of that is true - the javascript object model is extremely flexible, and allows you as the programmer to do things that can't be done without extreme contortions in languages like C++ and C#.

Today, we will only scratch the surface of that flexibility, but it should give you ideas about how to use javascript objects in your own web applications. The example that we will be working through today is a Color object for javascript. So lets get straight down to it! This is a simple object definition and instantiation. Lets take this example up a notch: So why are we doing this?

Javascript Tutorial - Simple Fade Animation. Woohoo fading! Everyone loves fading in and out, it is an excellent way to transition between two segments of an application (unless the fade takes too long, and then it just gets annoying). Today we are going to look at a simple and robust way of creating a fade in or fade out effect using javascript and the simple css 'opacity' element.

In the example below, you can see a green box with some text, and a button beneath it. If you press the button, the green box will fade out and become fully transparent, and if you press the button a second time, the box will fade back in. So how is all of this done? This fade function takes an element id, and the first thing we do is resolve it into an element object.

If the FadeState is 1 or -1, it means that an animation is currently in progress. As always, the first thing we do inside an animation function is figure out how much time has passed since the animation was last updated. So how do we actually set opacity? Back to the function at hand.