begin process at 2012 05 29 14:18:21
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Javascript / DHTML / Ajax

 > 

JavaScript Orienté objet (POO)

 > 

Divers

 > 

javascript et w3c


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

javascript et w3c

lundi 25 mai 2009 à 09:28:48 | javascript et w3c

dadateite

j'aimerais faire passer ce script aux normes W3C mais il ne pass epas:
<script language="javascript">

<!-- DEBUT DU SCRIPT -->
/*
Snow Effect Script
Created and submitted by Altan d.o.o. (snow@altan.hr,  http://www.altan.hr/snow/index.html)

EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/

  var snowsrc="images/goutte.png"
  var snowsrc2="images/goutte2.png"
  var no = 3;/*ici on change le nombre de goutte a afficher en meme temps sur l'ecran*/
  var ns4up = (document.layers) ? 1 : 0;
  var ie4up = (document.all) ? 1 : 0;
  var nn6up = (document.getElementById) ? 1 : 0;
  var dx, xp, yp;
  var am, stx, sty;
  var i, doc_width = 800, doc_height = 600;

if (ns4up)
{
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}

else if (ie4up)
{
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}

else if (nn6up)
{
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();

  for (i = 0; i<no; ++ i)
  {
dx[i] = 0;
xp[i] = Math.random()*(doc_width-50);
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();

if (ns4up)
{
if (i == 0)
{
document.write("<layer name=dot"+ i +" left=15 top=15 visibility=show><img src='"+snowsrc2+"' border=0></layer>");
}

else
{
document.write("<layer name=dot"+ i +" left=15 top=15 visibility=show><img src='"+snowsrc+"' border=0></layer>");
}
}

else if (ie4up || nn6up)
{
  if (i == 0)
  {
document.write("<div id=dot"+ i +" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=0></div>");
  }
  
  else
  {
document.write("<div id=dot"+ i +" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc2+"' border=0></div>");
  }
}
  }

function snowNS()
{
for (i = 0; i < no; ++ i)
{
  yp[i] += sty[i];
if (yp[i] > doc_height-50)
{
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
   }

  dx[i] += stx[i];
  document.layers["dot"+i].top = yp[i];
  document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", 10);
  }

function snowIE()
{
for (i = 0; i < no; ++ i)
{
  yp[i] += sty[i];
if (yp[i] > doc_height-50)
{
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}

  dx[i] += stx[i];
  document.all["dot"+i].style.pixelTop = yp[i];
  document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowIE()", 10);
  }

function snowNN6()
{
for (i = 0; i < no; ++ i)
{
  yp[i] += sty[i];
if (yp[i] > doc_height-50)
{
xp[i] = Math.random()*(doc_width-am[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
  }

  dx[i] += stx[i];
  document.getElementById("dot"+i).style.top = yp[i];
  document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i]);
}

setTimeout("snowNN6()", 3);/*vitess des gouttes*/

  }
  if (ns4up) {
snowNS();
  } else if (ie4up) {
snowIE();
  } else if (nn6up) {
snowNN6();
  }

</script>

<!-- FIN DU SCRIPT -->

et voici les debuts d'erreurs:
Line 309, Column 30: required attribute "type" not specified
<script language="javascript">

&#9993;

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>.
Line 355, Column 23: character ";" not allowed in attribute specification list
  for (i = 0; i<no; ++ i)

&#9993;
Line 355, Column 23: element "no" undefined. Did you mean "noframes" or "noscript"?
  for (i = 0; i<no; ++ i)

&#9993;

You have used the element named above in your document, but the document type you are using does not define an element of that name. 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 "Frameset" document type to get the "<frameset>" element),
by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
Line 368, Column 36: Attribute "name" exists, but can not be used for this element.
document.write("<layer name=dot"+ i +" left=15 top=15 visibility=show><im

&#9993;

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. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.



merci de m'aider
lundi 25 mai 2009 à 11:28:30 | Re : javascript et w3c

psyckan

Bonjour,

Plusieurs choses :
- rajoute type="text/javascript" à ta balise <script>
- Je ne pense pas que la balise <layer> soie reconnu par W3C
- Tes attributs left et top doivent comporter une unité or tu à ça par exemple :

document.getElementById("dot"+i).style.top = yp[i];

à remplacé par : document.getElementById("dot"+i).style.top = yp[i]+'px';

Je ne sais pas pour les attributs pixelTop et pixelLeft, mais ça doit surement être pareil



Cette discussion est classée dans : doc, math, document, for, width


Répondre à ce message

Sujets en rapport avec ce message

animation JS "au dessus" d'un flash [ par feydakin ] bonjour, je voudrais faire defiller le script javascript suivant ********* var snowsrc="**image**.gif" var no = 15; var ns4up = (document.layers) Effet neige a l'invers [ par lnazcal ] Bonjour,Comment le sujet le dit si bien je cherche un javascript qui fasse un effet boules dans un verre de cola.Je me suis dit que il faudré changer probleme script qui ne marche que sous IE [ par Azrael24 ] Bonjour à tous. je m'inicie au javascript et le "petit" script que j'ai mis sur mon site ne marche que sous IE.[code]script language=<span class="att de la vitesse [ par peterbud ] Bonjour à tous, Alors voilà,mon script me permet de faire tomber des gouttes de pluie sur ma page et ce que je cherche à faire c'est à varier la vites Déplacement calque et "NomDiv IS NOT DEFINED"... [ par mario_a_nantes ] Salut!Je me met doucement au javascript et ... j'ai un PROBLEMEJe souhaite déplacer un calque suivant des coordonnées que je calcule, tout en garantis Script Automne [ par potaba ] Bonjour !!!!      J'ai trouvé une superbe script en rapport avec l'automne pour mon forum mais il n'est que compatible avec Internet explorer Est-ce q Probleme de compatibilité avec Firefox. [ par Plopinettedu63 ] Bonjour,J'ai trouvé un scrip en javascript qui permet de fare tomber de la neige en arrière plan d'un site. Le script marche trés bien. le seul soucis Moteur de recherche en javascript [ par taxitat ] Bonjour à tous,J'ai recement trouvé un script sur ce site qui n'est autre qu'un moteur de recherche en javascript. Je l'ai adopté et modifié à ma guis Problème avec le Script: IMAGE QUI CHANGE AU SURVOL DE LA SOURIS image ... [ par xp3d ] Bon soir à tous,Il y a un Scipt en bas de cette page http://www.smkdgg.com/Filme.html "le code des deux boutons qui se mette en rouge disque on les su Compatibilité script ie-mozilla [ par jo83 ] Bonjour à tous, voici mon premier post sur ce forum où mes recherches de programmation en java m'ont conduites. Mes connaissances réduites m'ont permi


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,983 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales