34.1 - Les anchors
34.2 - Les Applets
34.3 - Area
34.4 - Array
34.5 - Booléen
34.6 - Boutons
34.7 - Checkbox
34.8 - Date
34.9 - Document
34.10 - Eléments tableaux
34.11 - File Upload
34.12 - Formulaires
34.13 - Frames
34.14 - Function
34.15 - Hidden
34.16 - History
34.17 - Image
34.18 - Link
34.19 - Location
34.20 - Number
34.21 - Math
34.22 - Navigator
34.23 - Option
34.24 - Password
34.25 - Plugin
34.26 - Radio
34.27 - Reset
34.28 - Select
34.29 - String
34.30 - Submit
34.31 - Text
34.32 - Textarea
34.33 - Window
Si le chapitre précédent donnait les éléments essentiels à la compréhension du langage, celui-ci se penche sur les classes en essayant d'illustrer les définitions autant que faire se peut.
Les exemples choisis sont simples pour faciliter la compréhension. Le chapirtre suivant étudie des cas complexes sous formes d'exercices.
Nom | Définition | Voir aussi |
---|---|---|
anchor | Les anchors sont les destinations (ou les signets) des liens hypertextes | Link |
Syntaxe | <A HREF="URL" NAME="Nom" TARGET="fenetre"> Texte </A> | Définition |
Tableau | document.anchors[0] .. document.anchors[document.anchors.length - 1 ] | - |
Propriété | length | - |
Méthode | eval toString valueOf | - |
Se rapporte à | document | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
applet | permet d'accéder aux paramètres d'une applet L'applet doit être appelée avec un paramètre MAYSCRIPT | Applet |
Syntaxe | document.Applet[numero]
<APPLET CODE="monapplet.class" WIDTH50 HEIGHT=25 NAME="momApp" MAYSCRIPT> |
Définition |
Tableau | document.applets[] | - |
Propriété | length (nombre d'applets dans le doc) | - |
Méthode | eval toString valueOf | - |
Se rapporte à | document | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
Area | permet la gestion des AREA des MAPS | link |
Syntaxe | Voir exemple AREA
<MAP NAME="nomImage"> <AREA> </MAP> |
MAP |
Tableau | - | - |
Propriété | hash host hostname
href pathname port protocol search target |
- |
Méthode | - | - |
Se rapporte à | document | - |
Evénement | onMouseOut onMouseOver | - |
Exemple | - | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
Array | permet la déclaration de tableaux | link |
Syntaxe | monTableau = new
Array (taille) monTableau[0]="Gilles" |
MAP |
Tableau | - | - |
Propriété | length prototype | - |
Méthode | join reverse sort | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | - | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir |
---|---|---|
boolean | permet la création /l'utilisation de types booléns | - |
Syntaxe | Déclaration : objetboolen = new Boolean(value) Utilisation : objetbooleen.propertyName | - |
Tableau | - | - |
Propriété | prototype | - |
Méthode | eval toString valueOf | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | bNoParam = new Boolean() bZero = new Boolean(0) bNull = new Boolean(null) bEmptyString = new Boolean("") bfalse = new Boolean(false) | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir |
---|---|---|
button | Bouton dans une page HTML | form - reset - submit |
Syntaxe | <INPUT TYPE="button" NAME="Nom" VALUE="texte" onClick="appelFonction"> | Définition INPUT |
Tableau | - | - |
Propriété | name - value - type | - |
Méthode | click blur focus (blur et focus Netscape 3) | - |
Se rapporte à | form | - |
Evénement | onClick onFocus onBlur | - |
Exemple | Sources | |
Remarque | Button a été ajouté comme possibilité de la balise FORM avec le champ onClick, évitant le bouton submit | - |
Nom | Définition | Voir |
---|---|---|
checkbox | Les boîtes à cocher permettent la sélection d'un objet à 0 ou à 1 | form - radio |
Syntaxe | <INPUT TYPE="checkbox" NAME="Nom" VALUE="Valeur" CHECKED onClick="appelFontion"> | Définition INPUT |
Tableau | - | - |
Propriété | checked - defaultChecked - name - value - type | - |
Méthode | click blur focus (blur et focus Netscape 3) | - |
Se rapporte à | form | - |
Evénement | onClick onFocus onBlur | - |
Exemple | Sources de l'exemple de checkbox | - |
Remarque | La valeur onClick a été ajoutée au type checkbox existant | - |
Nom | Définition | Voir |
---|---|---|
date | L'objet date permet d'utiliser la date et l'heure | - |
Syntaxe | new Date() ,new Date("month day, year hours:minutes:seconds"), new Date(year, month, day), new Date(year, month, day, hours, minutes, seconds) | - |
Tableau | - | - |
Propriété | - | - |
Méthode | getDate - getDay - getMinutes- getMonth - getSeconds - getTime - getTimeZoneoffset - getYear - parse - setDate - setHours - setMinutes - setMonth - setSeconds - setTime - setYear - toGMTString - toLocaleString - UTC - prototype | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | Sources de l'affichage de l'heure | - |
Remarque | Il est normal que l'heure de s'affiche pas si vous imprimez le document, car le code généré par JavaScript ne s'imprime pas! | - |
Nom | Définition | Voir |
---|---|---|
document | L'objet document contient les propriétés énumérées ci-après | window - frame |
Syntaxe | <BODY BACKGROUND="backgroundImage" BGCOLOR="backgroundColor" TEXT="foregroundColor" LINK="unfollowedLinkColor" ALINK="activatedLinkColor" VLINK="followedLinkColor" onLoad="handlerText" onUnload="handlerText"> | Définition BODY |
Tableau | - | - |
Propriété | alinkColor - anchors - bgColor - cookie - fgColor - forms - lastModified - linkColor - links - location - referrer - title - vlink | - |
Méthode | clear - close - open - write -writeln | - |
Se rapporte à | window | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
element array | les tableaux éléments permettent d'indexer les éléments d'un formulaire par ordre d'apparition (check box, text area..) | form |
Syntaxe | formName.elements[index] - formName.elements.length | - |
Tableau | document.anchors[0] .. document.anchors[document.anchors.length - 1 ] | - |
Propriété | length | - |
Méthode | - | - |
Se rapporte à | form | - |
Evénement | - | - |
Exemple | - | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
FileUpload | l'attribut file Upload permet d'envoyer un fichier vers le serveur à partir du navigateur. | form |
Syntaxe | <INPUT
TYPE="file"
NAME="fileUploadName" [onBlur="texte"] fileUploadName.propertyName fileUploadName.methodName |
- |
Tableau | document.anchors[0] .. document.anchors[document.anchors.length - 1 ] | - |
Propriété | name - type - value - formproperties | - |
Méthode | blur - eval - focus - toString - valueOf | - |
Se rapporte à | form | - |
Evénement | onBlur onChange onFocus | - |
Exemple | <FORM
NAME="form1"> Fichier à envoyer: <INPUT TYPE="file" NAME="myUploadObject"> <P>Get properties<BR> <INPUT TYPE="button" VALUE="name" onClick="alert('name: ' + document.form1.myUploadObject.name)"> <INPUT TYPE="button" VALUE="value" onClick="alert('value: ' + document.form1.myUploadObject.value)"><BR> </FORM> |
|
Remarque | FileUploadName est bien la valeur à renseigner pour accéder à l'objet FileUpload, ce n'est pas le nom du fichier à envoyer. Nescape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
form | les formulaires permettent de gérer les entrées claviers (zones textes, boutons radio etc.) | button - checkbox - hidden - password - radio - reset - select - submit - text - textarea |
Syntaxe | <FORM NAME="nom" TARGET="fenetre" ACTION="action" METHOD=GET | POST ENCTYPE="encodingType" onSubmit="appelFonction"> </FORM> | définition des FORM |
Tableau | document.forms[index]- document.forms.length | - |
Propriété | action - elements - encoding - length - method - target | - |
Méthode | submit reset (version 3) | - |
Se rapporte à | document | - |
Evénement | onSubmit onReset | - |
Exemple | Sources du contrôle des entrées d'un formulaire | |
Remarque | On le voit, l'événement onSubmit est un moyen efficace de tester les champs entrés dans un formulaire | - |
Nom | Définition | Voir aussi |
---|---|---|
frames | les frames sont les sous fenêtres indépendantes d'une page HTML | window - document |
Syntaxe | <FRAMESET
ROWS="hauteur" COLS="largeur"
onLoad="appelfonction" onUnload="appelfonction"> <FRAME SRC="URL" NAME="nom"> </FRAMESET> |
définition FRAME |
Tableau | [frameReference.]frames[index] - [frameReference.]frames.length -[windowReference.]frames[index] - [windowReference.]frames.length | - |
Propriété | length - parent - self - window | - |
Méthode | clearTimeout - setTimeout - blur - focus | - |
Se rapporte à | frame - window | - |
Evénement | onBlur - OnFocus | - |
Exemple | Sources de l'exemple | - |
Remarques | - | - |
Nom | Définition | Voir aussi |
---|---|---|
Function | spécifie une séquence à compiler sous la forme d'une fonction | - |
Syntaxe | Nomfonction= new Function ([arg1, arg2, ... argn], corps de la fonction)> | - |
Tableau | - | - |
Propriété | arguments array caller prototype | - |
Méthode | eval toString valueOf | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | var setBGColor = new Function("document.bgColor='antiquewhite'") | - |
Remarques | Netscape 3.0 - Moins efficace qu'un appel de fonction non compilé. | - |
Nom | Définition | Voir aussi |
---|---|---|
hidden | l'argument hidden permet de soumettre une requête de formulaire au serveur sans afficher la commande ainsi masquée | cookie |
Syntaxe | <INPUT TYPE="hidden" NAME="nom" VALUE="texte"> | définition INPUT |
Tableau | - | - |
Propriété | name - value type | - |
Méthode | eval toString valueOf | - |
Se rapporte à | form | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
history | permet de récupérer la liste des précédentes pages visitées par le navigateur | - |
Syntaxe | history.propertyName - history.methodName(parameters) | - |
Tableau | history (3) | - |
Propriété | length | - |
Méthode | back forward go + current next previous (Version 3) | - |
Se rapporte à | document | - |
Evénement | - | - |
Exemple | Sources d'un bouton Reload | - |
Remarque | History permet de simuler également les autres touches de navigation de votre logiciel. | - |
Nom | Définition | Voir aussi |
---|---|---|
Image | L'objet
image peut être manipulé en JavaScript comme avec la
balise |
Images |
Syntaxe | imageName =
new Image([width, height]) imageName.propertyName |
- |
Tableau | document.image[numero|length] | - |
Propriété | border
complete height hspace lowsrc name prototype src vspace width |
- |
Méthode | eval toString valueOf | - |
Se rapporte à | document | - |
Evénement | onAbort onError onLoad | - |
Exemple | Sources | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
link | les liens hypertextes | anchor |
Syntaxe | <A HREF=URL NAME="nom du signet" TARGET="fenetre" onClick="appelfonction" onMouseOver="appelFonction"> texte</A> | définition des URL |
Tableau | document.anchors[index] -document.anchors.length | - |
Propriété | hash - host - hostname - href - pathname - port - protocol - search - target - length | - |
Méthode | - | - |
Se rapporte à | document | - |
Evénement | onClick - onMouseOver onMouseOut | - |
Exemple | Sources d'un bouton Reload | annonce.htrm |
Remarque | Bien entendu, l'événement onMouseOver masque l'événement onClick | - |
Nom | Définition | Voir aussi |
---|---|---|
location | Permet d'extraire toutes les informations relatives à une URL | - |
Syntaxe | [windowReference.]location.nom | history - location |
Tableau | - | - |
Propriété | hash - host - hostname - href - pathname - port - protocol - search - target | - |
Méthode | reload replace | - |
Se rapporte à | document | - |
Evénement | - | - |
Exemple | Sources de la visualisation du protocole | - |
Remarque | hash désigne le nom du signet ou de l'ancre | - |
Nom | Définition | Voir aussi |
---|---|---|
Number | Objet permettant de manipuler des valeurs numériques | - |
Syntaxe | numberObjectName =
new Number() numberObjectName.propertyName |
- |
Tableau | - | - |
Propriété | MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY POSITIVE_INFINITY prototype | - |
Méthode | reval toString valueOf | - |
Se rapporte à | document | - |
Evénement | - | - |
Exemple | biggestNum = Number.MAX_VALUE | - |
Remarque | Netcape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
Math | ensemble de fonctions et valeurs mathématiques | - |
Syntaxe | Math.propertyName - Math.methodName(parameters) | - |
Tableau | - | - |
Propriété | E - LN2 - LN10 - LOG2E - LOG10E - PI - SQRT1_2 - SQRT2 | - |
Méthode | abs - acos - asin - atan - ceil - cos - exp - floor - log - max - min - pow - random - round - sin - sqrt - tan | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
navigator | information sur la version de navigateur utilisée | - |
Syntaxe | navigator.propertyName | - |
Tableau | - | - |
Propriété | appCodeName - appName - appVersion - userAgent + mimeTypes plugins (V3) | - |
Méthode | javaEnabled (V3) | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | Sources de l'affichage | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
option | Objet d'un champs SELECT | - |
Syntaxe | selectName.options selectName.options[index] selectName.options.length |
- |
Tableau | - | - |
Propriété | - | - |
Méthode | - | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | Sources de l'affichage | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
password | champs d'un formulaire remplis avec des caractères * | form - text |
Syntaxe | <INPUT TYPE="password" NAME="nom" VALUE="texte" SIZE=nombre> | - |
Tableau | - | - |
Propriété | defaultValue - name - value - type | - |
Méthode | focus - blur - select | - |
Se rapporte à | form | - |
Evénement | onBlur onFocus | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
Plugin | donne la liste des plugins installé sur le navigateur | - |
Syntaxe | navigator.plugins[index].propertyName navigator.plugins[pluginIndex][mimeTypeIndex].mimeTypePropertyName |
- |
Tableau | navigator.plugins[index] | - |
Propriété | description filename length name | - |
Méthode | eval toString valueOf | - |
Se rapporte à | navigator | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | Netscape 3.0 | - |
Nom | Définition | Voir aussi |
---|---|---|
radio | bouton radio dans un formulaire (choix exclusifs) | form - checkbox - select |
Syntaxe | <INPUT TYPE="radio" NAME="nom" VALUE="valeur" [CHECKED] [onClick="handlerText"] > | - |
Tableau | - | - |
Propriété | checked - defaultChecked - length - name - value + type (v3) | - |
Méthode | click blur focus | - |
Se rapporte à | form | - |
Evénement | onClick | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
select | menu à choix multiple dans un formulaire | form - checkbox - radio |
Syntaxe | <SELECT
NAME="nom" [SIZE="integer"]
[MULTIPLE] [onBlur="appelFonction"]
[onChange="appelFonction"] [onFocus="appelFonction"]> <OPTION VALUE="valeur" [SELECTED]> texte </SELECT> |
- |
Tableau | - | - |
Propriété | length - options - selectedIndex - defaultSelected - index - selected - text - value + type (V3) | - |
Méthode | blur - focus | - |
Se rapporte à | form - select | - |
Evénement | onBlur - onChange - onFocus | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
string | chaîne de caractères | - |
Syntaxe | chaine.propriété - chaine.méthode(paramètres) | text - textarea |
Tableau | - | - |
Propriété | length | - |
Méthode | anchor - big - blink - bold - charAt - fixed - fontcolor - fontsize - indexOf - italics - lastIndexOf - link - small - strike - sub - substring - sup - toLowerCase - toUpperCase | - |
Se rapporte à | - | - |
Evénement | - | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
submit | permet l'envoi au serveur http de la requête de formulaire | - |
Syntaxe | <INPUT TYPE="submit" NAME="Nom" VALUE="Texte" onClick="handlerText"> | form - reset |
Tableau | - | - |
Propriété | name - value + type (V3) | - |
Méthode | click + blur - focus (V3) | - |
Se rapporte à | form | - |
Evénement | onClick | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
text | texte entré dans un formulaire | - |
Syntaxe | <INPUT TYPE="text" NAME="Nom" VALUE="Valeur" SIZE=integer onBlur="handlerText" onChange="handlerText" onFocus="handlerText" onSelect="handlerText"> | password - form - string - textarea |
Tableau | - | - |
Propriété | defaultValue - name - value + type (V3) | - |
Méthode | focus - blur - select | - |
Se rapporte à | form | - |
Evénement | onBlur - onChange - onFocus onSelect | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
textarea | Zone de saisie de texte sur plusieurs lignes dans un formulaire | - |
Syntaxe | <TEXTAREA NAME="Nom" ROWS="integer" COLS="integer" textToDisplay onBlur="handlerText" onChange="handlerText" onFocus="handlerText" onSelect="handlerText">texte</TEXTAREA>, | password - form - string - text |
Tableau | - | - |
Propriété | - | - |
Méthode | focus - blur - select + type(V3) | - |
Se rapporte à | form | - |
Evénement | onBlur - onChange - onFocus onSelect | - |
Exemple | Sources | - |
Remarque | - | - |
Nom | Définition | Voir aussi |
---|---|---|
window | fenêtre à l'intérieur du navigateur ou fenêtre indépendante | - |
Syntaxe | windowVar = window.open("URL", "Nom" [,"options"]) | document - frame |
Tableau | - | - |
Propriété | defaultStatus - frames - length - name - parent - self - status - top - window | - |
Méthode | alert - close - confirm - open - prompt - setTimeout - clearTimeout | - |
Se rapporte à | - | - |
Evénement | onUnload | - |
Exemple | Sources | - |
Remarque | - | - |