5568 sujets

Sémantique web et HTML

Salut,

je me heurte à une erreur lors de la validation de mes pages (en XHTML strinct) pour l'attirbut "name" d'un menu déroulant pour la redirection de page.

Mon html :

<form method="post" id="redirect" name="redirect" action="redirect.php" >
	<p>
		<select size="1" name="url" onchange="navigation()">
			<option value="vide">- sites professionnels -</option>
			<option value="../pharmaciens/">&nbsp;pharmaciens</option>
			<option value="../medecins/">&nbsp;médecins</option>
		</select>
	</p>
</form>



Mon js :

function navigation(){
	if(document.redirect.url.value!="vide")
		{
		document.location=document.redirect.url.value;
		}
}


En le passant à la moulinette du W3C il me donne ceci :
a écrit :
Line 143 column 43: there is no attribute "name".
<form method="post" id="redirect" name="redirect" action="redirect.php" >


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.


Comment rendre mon code valide mais aussi fonctionnel Smiley smile

Merci par avance !
Modifié par dldstyle (30 Oct 2006 - 10:29)
J'ai trouvé la solution à mon problème :


function navigation(){
	if(document.forms["redirect"].url.value!="vide")
		{
		document.location=document.forms["redirect"].url.value;
		}
}


Bon par contre j'ai d'autres problèmes de validation avec les labels. Je vais creuser. Si je ne trouve pas... Smiley lol