Besoin d'un coup de pouce pour rendre un script valide W3c

WRInaute passionné
Bonjour,
Je tente en vint de rendre le script ci dessous valide W3C:
Code:
<script language="JavaScript" type="">
ejs_s_tabwidth = '400';
ejs_s_fontface = 'Arial';
ejs_s_fontsize = 2;
ejs_s_fontcolor0 = '#000000'
ejs_s_fontcolor1 = '#CC0000'
ejs_s_fontcolor2 = '#FFFFFF'
ejs_s_bgcolor1 = '#000000'
ejs_s_bgcolor2 = '#FFFFF'
ejs_s_bgcolor3 = '#####CC'
ejs_autre_js = 1;
ejs_s_time = new Date;
ejs_s_sec = ejs_s_time.getTime();
document.write('<script language="JavaScript" src=http://search.editeurjavascript.com/?')
document.write(ejs_s_sec+'><\/SCRIPT>');
</script>
La validation m'indique 4 erreurs mais vue que j'y vais un peut à taton et que je ne suis pas un as de l'anglais un petit coup de pouce rapide serait bienvenue.
Merciiiiiiiiiiiiiiii
 
WRInaute passionné
Biensur , les voilà :
Code:
Error Line 204 column 50: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.
document.write('<script language="JavaScript" src=http://search.editeurjavascript.com/?')

Error Line 204 column 56: NET-enabling start-tag not immediately followed by null end-tag.
document.write('<script language="JavaScript" src=http://search.editeurjavascript.com/?')
This error may occur when there is a mistake in how a self-closing tag is closed, e.g '.../ >'. The proper syntax is '... />' (note the position of the space). 

Error Line 204 column 56: required attribute "type" not specified.
document.write('<script language="JavaScript" src=http://search.editeurjavascript.com/?')
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>. 

Error Line 204 column 56: document type does not allow element "script" here.
document.write('<script language="JavaScript" src=http://search.editeurjavascript.com/?')
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed). 

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error). 

Warning Line 205 column 27: character "<" is the first character of a delimiter but occurred as data.
document.write(ejs_s_sec+'><\/SCRIPT>');
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.

Bon,ce n'est pas d'une grande importance non plus mais je m'éfforce à rendre mes pages valides.
 
WRInaute accro
Re: Besoin d'un coup de pouce pour rendre un script valide W

Ceci, déjà :

<script type="text/javascript">

pour chaque occurence d'une ouverture de tag <script ...
 
WRInaute accro
tryan a dit:
Bon,ce n'est pas d'une grande importance non plus mais je m'éfforce à rendre mes pages valides.
Si c'est le site de ton www, il faut déjà commencer par mettre un DOCTYPE, virer les attributs qui sont dépréciés (le bgcolor du body, etc...) :wink:
 
WRInaute passionné
Bonjour

Non , ce n'est pas le site de mon www,mais j'y viendrais :wink: (merci pour le doctype et autre).
merci Szarah pour le debut du script ... si tu as la suite ,n'hésite pas !
 
Discussions similaires
Haut