bonjour j'ai un PB pour valide mon code w3c en xhtml strict
a cause de la balise "form" si j'enleve le "name" la validation passe mais le code ne fonctionne plus.
merci d'avance pour vos reponse
erreur w3c
Below are the results of checking this document for XML well-formedness and validity.
1. Error Line 47 column 11: there is no attribute "name".
<form name="settings">
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.
✉
2. Error Line 47 column 21: required attribute "action" not specified.
<form name="settings">
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
Modifié par teca (16 Apr 2006 - 15:51)
a cause de la balise "form" si j'enleve le "name" la validation passe mais le code ne fonctionne plus.
merci d'avance pour vos reponse
erreur w3c
Below are the results of checking this document for XML well-formedness and validity.
1. Error Line 47 column 11: there is no attribute "name".
<form name="settings">
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.
✉
2. Error Line 47 column 21: required attribute "action" not specified.
<form name="settings">
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
<p>Diaporama :</p>
<form name="settings">
<div>
<input type="radio" name="order" value="normal" checked="checked"/><p>ordre normal</p>
<input type="radio" name="order" value="aléatoire"/><p>ordre aléatoire</p>
<input type="checkbox" name="repeat"/><p>répétition</p>
<p>Temporisation :</p>
<input type="text" name="tempo" value="3" size="4" maxlength="2" onkeyup="checkTempo()" onchange="checkTempo()"/><p>seconde(s)</p>
<input type="button" onclick="launchFirst()" name="bLaunch" value="Lancer" style="width:150px"/>
<input type="button" onclick="stop()" name="bStop" value="Stopper" style="width:150px" disabled="disabled"/>
</div>
</form>
</body>
/*diaporama*/
/*Merci a robloche http://robloche.free.fr */
var rep = ""; // Répertoire des images du diaporama (vide si meme repertoire que le fichier html)
var num = 0;
var myCounter;
var next_img = new Image;
var wPopup;
var tabImg;
var tabImgSave = new Array();
tabImgSave[0] = 'Tokyo/Tokyo1.jpg';
tabImgSave[1] = 'Tokyo/Tokyo2.jpg';
tabImgSave[2] = 'Tokyo/Tokyo3.jpg';
tabImgSave[3] = 'Tokyo/Tokyo4.jpg';
tabImgSave[4] = 'Tokyo/Tokyo5.jpg';
tabImgSave[5] = 'Tokyo/Tokyo6.jpg';
var nb_img = tabImgSave.length;
//
// Les trois fonctions suivantes (+ éventuellement, "mySplice")
// servent à mélanger un tableau quelconque à partir d'une
// permutation tirée aléatoirement
//
// Méthode "splice" si elle n'existe pas
// tab : tableau
// s : début de la suppression
// l : nombre d'éléments à supprimer
function mySplice(s, l) {
if(s+l > this.length) l = this.length-s;
for(var i=s; i<this.length; ++i)
this[i] = this[i+1];
delete this[this.length-1];
this.length--;
}
// Est-ce que la méthode "splice" est disponible ?
if(!Array.prototype.splice) {
// Non, alors on utilise la version "maison"
Array.prototype.splice = mySplice;
}
// Génère une fonctione sous-excédente
function fctSsExc() {
var fct = new Array;
for(var i=0; i<nb_img; i++) {
fct[i] = Math.floor( Math.random()*(nb_img-i) );
}
return fct;
}
// Construit une permutation à partir d'une fonction sous-excédente
function buildSigma() {
var fct_ss_exc = fctSsExc();
var set_N = new Array;
for(var i=0; i<nb_img; i++) {
set_N[i] = i;
}
var sigma = new Array;
for(var i=0; i<nb_img; i++) {
sigma[i] = set_N[fct_ss_exc[i]];
set_N.splice(fct_ss_exc[i],1);
}
return sigma;
}
// Retourne une version mélangée du tableau passé en paramètre
function shuffleArray(myArray) {
var sigma = buildSigma();
var newArray = new Array;
for(var i=0; i<nb_img; i++) {
newArray[i] = myArray[sigma[i]];
}
return newArray;
}
//
// Fin des fonctions de mélange
//
// Donne le focus au bouton "Lancer"
function focusOnLaunch() {
window.document.forms.settings.bLaunch.focus();
}
// Donne le focus au bouton "Stopper"
function focusOnStop() {
window.document.forms.settings.bStop.focus();
}
function next() {
// Est-ce que l'image suivante est oréchargée ?
if(next_img.complete) {
// Oui, alors après le temps de pause choisi par l'utilisateur, cette image remplacera l'actuelle
myCounter = setTimeout("launch()", 1000*window.document.settings.tempo.value);
}
else {
// Non, alors on continue d'attendre qu'elle le soit
myCounter = setTimeout("next()", 250);
}
}
// Lance le slideshow
function launchFirst() {
// Petite vérification de la temporisation choisie
if(window.document.settings.tempo.value == "") {
alert("Précisez une temporisation entre 0 et 60 secondes...");
return false;
}
// Ordre normal ou aléatoire
if(window.document.settings.order[1].checked) {
tabImg = shuffleArray(tabImgSave);
}
else {
tabImg = tabImgSave;
}
// Avant de lancer le slideshow, on désactive tous les éléments du formulaire
// et on active le bouton "Stopper"
next_img.src = rep+tabImg[0];
window.document.forms.settings.bStop.disabled = false;
focusOnStop();
window.document.forms.settings.bLaunch.disabled = true;
window.document.forms.settings.repeat.disabled = true;
window.document.forms.settings.order[0].disabled = true;
window.document.forms.settings.order[1].disabled = true;
window.document.forms.settings.tempo.disabled = true;
launch();
}
// Poursuit le slideshow
function launch() {
// Si la fenêtre n'existe pas ou est fermée, on la réouvre
if(!wPopup || wPopup.closed) {
wPopup = window.open('', 'img_popup', 'width=50, height=50, top='+(screen.height-50)/2+', left='+(screen.width-50)/2+', status=no, directories=no, toolbar=no, location=no, menubar=no, scrollbars=no, resizable=yes');
}
// On écrit le contenu de la fenêtre popup
wPopup.document.clear();
wPopup.document.write("<HTML><HEAD><TITLE>Slideshow : "+(num+1)+"/"+nb_img+"</TITLE></HEAD>");
// La fonction qui attend que l'image soit chargée et affichée pour redimensionner la fenêtre à la bonne taille
wPopup.document.write('<SCRIPT language="JavaScript">\nfunction checkSize() { if(document.images && document.images[0].complete) { w = document.images[0].width+5; h = document.images[0].height+54; window.resizeTo(w, h); window.moveTo((screen.width-w)/2, (screen.height-h)/2); document.images[0].style.visibility = "visible"; window.focus(); if(opener.next_img.src != opener.rep+opener.tabImg[opener.num]) { opener.next_img.src = opener.rep+opener.tabImg[opener.num]; } } else { setTimeout("checkSize()", 250); } }\n</'+'SCRIPT>');
wPopup.document.write('<BODY bgcolor="#FFFFFF" leftMargin="0" topMargin="0" marginWidth="0" marginHeight="0">');
wPopup.document.write('<table width="100%" height="100%" align="center" cellpadding="0" cellspacing="0"><tr valign="middle"><td align="center"><img src="'+next_img.src+'" border="0" onLoad="checkSize()" onClick="window.opener.stop()" style="visibility:hidden"></td></tr></table>');
wPopup.document.write('</BODY></HTML>');
wPopup.document.close();
num++;
// On a passé toutes les images, on repart du début
if(num == nb_img) num = 0;
// Si "Répéter" n'est pas cochée, on stoppe le slideshow
if(num == 0 && !window.document.settings.repeat.checked) {
setTimeout("stop()", 1000*window.document.settings.tempo.value);
return false;
}
// En cas de répétition en mode aléatoire, on remélange les images
if(num == 0 && window.document.settings.order[1].checked) {
tabImg = shuffleArray(tabImgSave);
}
next();
}
// Stoppe le slideshow
function stop() {
clearTimeout(myCounter);
wPopup.close();
// On réactive tous les éléments du formulaire
// et on désactive le bouton "Stopper"
window.document.forms.settings.bLaunch.disabled = false;
focusOnLaunch();
window.document.forms.settings.bStop.disabled = true;
window.document.forms.settings.repeat.disabled = false;
window.document.forms.settings.order[0].disabled = false;
window.document.forms.settings.order[1].disabled = false;
window.document.forms.settings.tempo.disabled = false;
num = 0;
}
// Vérification de la temporisation à chaque modification de celle-ci
function checkTempo() {
var t = window.document.settings.tempo.value;
if(isNaN(t) || t<0 || t>60) {
window.document.settings.tempo.value = 3;
alert("Mauvaise temporisation...\nEntrez un temps compris entre 0 et 60 secondes.");
return false;
}
}
[/i][/i][/i][/i][/i][/i][/i][/i] Modifié par teca (16 Apr 2006 - 15:51)