Accueil > Cours Javascript

Traduction de la page Table of contents rédigée par Peter-Paul Koch et traduite par Christophe Bruggeman

La traduction est en cours, si vous trouvez une erreur sur une page ou si vous souhaitez suggérer une amélioration, n'hésitez pas à utiliser le forum.

Table des matières JavaScript

Le JavaScript est un langage de programmation non compilé, orienté objet, principalement utilisé dans les pages Web.

L'auteur divise les pages ainsi 'Debutant' et 'Intermédiaire'. Si vous débuter le JavaScript, je vous conseil de lire et comprendre au moins 80% des pages 'Debutant' avant de vous lancer dans les pages 'Intermédiaire'.

Modules | Scripts divers | Formulaire | Frames and windows | Date et heure | DHTML | Events

Cette page est une introduction au Javascript.
La différence entre le Javascript et le Java. Quelles sont les possibilités et les restrictions du JavaScript? Sécurité. Quelles sont les différentes versions de Javascript ? Que pensez-vous de ces versions? Comment débugger un script?

Modules

Ces pages parlent des principes fondamentaux du JavaScript. Elles ne contiennent pas de scripts mais décrivent les techniques qui serviront de modules pour vos scripts.
Comment ajouter du Javascript dans vos pages HTML. les includes JavaScript. The tag <noscript>.
La détection d'objet est un concept très important que les débutants devraient étudier attentivement. Si vous écrivez un script complexe, vous commencez par chercher à savoir si les navigateurs de vos utilisateurs peuvent supporter un script avancé. Pour faire ceci, vous avez besoins de la détection d'objet. La page inclue également quelques études de cas.
Les déclarations sont des commandes JavaScript. Sur cette page je décris les deux plus importantes: if() et for(). Vous emploirez ces déclarations dans tous les scripts que vous écrirez, c'est pourquoi il est important de les étudier en détails.
Tous les scripts que vous écrirez sont composés de fontions. Une fonction est une courte série de commandes qui fait quelques choses pour vous. Cette page explique en détails comment fonctionnent les fonctions, ce qu'on attend d'elles et ce qu'elles attendent de vous.
Les string sont également très important. Un string est une chaîne de caractères, comme 'Bonjour!' ou 'http://www.quirksmode.org' ou '14'. Vous avez souvent besoin de les afficher ou de les modifier. Cette page donne de nombreux details.
Le JavaScript est sencé changer quelque chose sur la page. Pour faire ceci, il a besoin d'acceder au document HTML, par exemple pour vérifier la saisie d'un utilisateur dans un formulaire ou pour changer une image src onmouseover. Par conséquent tous les navigateurs ont un modèle objet de documents, qui vous donne l'accès à différentes parties du document. Le DOM niveau 0 est le plus ancien de tous. Il à été mis en application dans Netscape 2 et 3 et fonctionne toujours dans tous les navigateurs Javascript. Il permet d'accéder facilement aux formulaires et à leurs éléments, ainsi qu'aux images et liens.
Théoriquement vos pages Javascript devraient rester accessibles pour les navigateurs noscript et les screen readers. Malheureusement il n'y a aucune règle qui permette de rendre les scripts accessibles. Cette page donne quelques études de cas qui vous aiderons à concevoir vos propres solutions et à trouver des issus.
Bien que l'accessibilité soit importante pour les débutants, J'ai placé cette page dans la classe intermédiaire car vous devez vous familiariser avec les bases du JavaScript avant de lire et écrire une bonne études de cas. (page non traduite car contenu indiqué comme périmé par l'auteur)
La logique booléenne est utilisé dans tous les langages de programmation. Elle définie l'utilisation de AND (&&), OR (||) et NOT (!).
Netscape 4 et Internet Explorer 4 ont chacun leurs propres Document Object Model, document.layers et document.all. Ils sont sencés apporter un support au DHTML, et permettre le changement du CSS au moyen du JavaScript. Bien sûr ils sont aussi différents qu'un DOM peut l'être. Le sujet de cette page est de vous enseigner le cross-browser en DHTML. Donc cette page traitera des deux DOM intermédiaire, et un peut du DOM W3C.
Le JavaScript vous permet de définir vos propres objets. En général ils sont complètement inutiles car la plupart des navigateurs génèrent largement assez d'objets pour contenter tout le monde.
Cette page détaille la seule utilisation d'objets prédéfini que j'ai jamais trouvés: la création de tableaux associatifs. Cette page explique également for (var i in object).
this est un mot-clé très important, mais difficile à utiliser si vous ne savez pas exactement comment il fonctionne. Cette page traite de this dans la gestion des événements (event handling).

Scripts divers

Voici les scripts difficile à classer, ils sont rangés des plus vieux scripts classiques aux plus récents scripts expérimentaux.
Ma dernière version de ce classique.
window.print() Imprimer une page, mais quelques navigateurs ne supportent pas cette méthode. Cette page contient du VBScript qui fonctionne aussi dans les anciens Internet Explorer.
N'utilisez pas ce script, les débutants surestime souvent l'importance d'un détecteur de navigateur. Lisez d'abord la page Détection d'objet.
Tout script utilisant un détecteur de navigateur est incorrect.
Une extension de mon script de détection des navigateurs qui permet de garder plusieurs versions d'Internet Explorer à distance.
Ce script vérifie si un navigateur a le plugin Flash d'installé, et si c'est le cas quelle est la version. Ce script est beaucoup plus simple et performant que celui de Macromedia, ou que n'importe quel autre script disponible sur le WWW.
Fonctionne également pour d'autres plugins tels que Real Player et Acrobat.
How to communicate between ActionScript and JavaScript. ActionScript to JavaScript is easy, JavaScript to ActionScript is far more complicated.
Cookies store information about your users or their preferences. This information is stored in your users' browsers and is available when that particular user visits your site again.
This small script finds text the user has selected with his mouse.
This script writes new content into a layer. It's somewhat buggy in Netscape 4.

Formulaire

Form influencing is as old as JavaScript. It has remained important up to the present day. In addition, the basics of form handling are not very difficult. Influencing forms is an excellent way to get to know JavaScript better.
An introduction to accessing forms and writing form validation scripts. Details about accessing form elements and finding out what the user has done.
A simple example script that validates a form. I can't give generic scripts for form validation since every form is different and every site needs its own brand of form validation.
Select boxes have become powerful navigation tools. This simple script allows you to switch pages based on the selection of an option.
You can change which options are shown in a select box. This is often useful when you have several select boxes for a complicated navigation or for complicated selection tasks.
Sometimes it's useful to disable a form field. The user cannot enter anything, and in modern browsers gets a visual cue, too. This page includes a workaround for browsers that don't support the disabled property.

Frames et fenêtres

JavaScript allows communication between frames and with windows that are opened by JavaScript. The basics are quite simple, but there are some special cases in which influencing frames or windows is much more complicated.
This page explains how to access other frames.
Popups are windows opened by JavaScript. The advantage is that you can specify the appearance of popups in great detail. The disadvantage is that many users are fed up with popups because often they don't serve any purpose.
Once you opened a popup you can establish communication between the popup and the opening page. This page gives the details.
Creating a customized frameset, in which you can select which pages are loaded into the frames, is useful when you're working with a frames site but nonetheless want to allow 'deep-linking'. I use the script on this site to allow users to enter on any page they like, but within my frameset.
Some site owners wish to claim the content of external sites by capturing it in their own frameset. This script details how you can find out whether this has happened, and how you can bust out of someone else's frameset.
Iframes are inline frames, which means they're shown within a normal HTML page. Accessing an iframe is tricky. This page gives the details.
Parts have moved to the Viewport section. I retain the link here only for backwards compatibility with my old JavaScript Section.
The less interesting part has been moved to the Archives.

Date et heure

JavaScript can read out the date and time according to the user's computer. Although this seems quite useful, the illogical date formats we humans use combined with browser incompatibilities in handling daylight saving time and timezones and such make the writing of a serious Date and Time script a very difficult job.
General information. Epoch time, the Date object, the millennium problem.
Finding the date and time and displaying it in a user friendly way.
Finding out if a date a user has entered exists, and whether it lies in the past or the future.
Internet Beat time is a time measurement system that divides the day into 1000 beats of 86.4 seconds each. It creates a truly worldwide time system so that people in wildly different timezones can agree to mail "around @600". This page gives a simple script to calculate the Internet Beat.
document.lastModified gives the last modification date of an HTML page, if the server is configured to send this information. This page gives a script to present last modification information in a user friendly way. I use it on every page on this site.

DHTML

DHTML is the changing of CSS by means of JavaScript. Modern browsers can handle pretty much anything you can throw at them, so you can enliven your page with some well-chosen DHTML effects. These pages give the gory details of cross-browser DHTML scripting and some example scripts.
A detailed explanation of what DHTML is.
The worst DHTML problem is accessing an element. You need no less than three code blocks to do it properly. This tiny script manages element accessing for you. It's my answer to the hideous 100K object oriented junkyard bloatware that's wandering around the WWW in ghostly torment. You don't need a library, just my function and some general DHTML knowledge.
Some simple DHTML examples to show what DHTML can do for you.
The script I use in the navigation frame. It's based on the changing of the display style of certain elements.
This script calculates the actual position of an HTML element on a page.
This script creates and manages a scrolling layer for you.
This script manages a 'sticky' menu that appears in the same position every time the user stops scrolling. It's my emulation of position: fixed.
This script creates an interface for bilingual pages. The user selects a preferred language, which is shown large. The other language disappears to the side, but remains clickable. I use this script in, for instance, my my Portfolio or Publications pages.
This script enables and disables entire style sheets, so you can radically change the layout of your pages without a round-trip to the server.

Events

Without event handling there is no JavaScript. Any script waits for a certain user action (mousing over a link, clicking on the Submit button) and then reacts to this event. These pages give a complete overview of event handling, both ancient and modern. There are no example scripts since event handling is ubiquitous. See any other script on this site for a good example.
General introduction to event handling. Overview of the right questions and the right answers.
Detailed description of available cross-browser events.
This page details event handling as supported by Netscape 2 and 3, and hence by all other browsers. Registring event handlers, default actions and the preventing thereof.
This page explains the traditional event registration model, which works in all modern browsers. It also discusses the use of anonymous functions and some drawbacks of the model.
This page discusses the advanced event registration models of W3C and Microsoft. W3C's model is good, Microsoft's isn't.
This page explains how to access an event object. This is necessary if you want to read out event properties.
This page discusses interesting event properties and the severe browser incompatibilities surrounding their use.
This page discusses the two event order models. When the user clicks on a nested element and both this element and its parent element have an onclick event handler, which one fires first?
Detailed treatment of the mouse events: mouseover, mouseout, mousedown, mouseup, mousemove, click and dblclick.
This page details the Netscape 4 event model. It's pretty complicated and even Netscape 4 itself doesn't always follow this model, and its documentation is incorrect at certain points.
Quick compatibility tables for the most common events and event properties. Includes links to the event pages where the properties are discussed.
To keep our sites accessible to non-mouse users we must use non-mouse events like focus or keydown in addition to mouse events. Which non-mouse events can be paired with which mouse events?
Liens Relatifs : Cours informatique  -  Cours Débutant  -  Cours Linux  -  Cours Réseaux  -  Cours Ergonomie  -  Formation Excel  -  Formation Word  -  Télécharger un cours

Partenaires : Immobilier entre particuliers job etudiant Annonces gratuite Guide cours Nom Domaine Astuces Vista