11548 sujets

JavaScript, DOM et API Web HTML5

Bonsoir,

J'ai un petit soucis avec un code javascript qui ne passe pas le test xhtml 1.0 strict du w3c :

Line 138, Column 28: character "&" is the first character of a delimiter but occurred as data

      if (instances%2 != 0 && text2 != ""){ sel.value = sel.value + text2; } 

✉

This message may appear in several cases:

    * You tried to include the "<" character in your page: you should escape it as "&lt;"
    * You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
    * Another possibility is that you forgot to close quotes in a previous tag.



Le problème vient des &&.

Comment corriger ce problème ?

Merci par avance Smiley smile
Bonsoir,

Merci pour ta réponse mais ça ne fonctionne pas Smiley ohwell

J'ai résolu le problème en modifiant la ligne par

if (instances%2 != 0)
		{
			if(text2 != "")
			{
				sel.value = sel.value + text2;
			}
		}


Bonne soirée Smiley smile