Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1404 connectés 

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  [Javascript]remplacer document.all par document.getElementbyID

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Javascript]remplacer document.all par document.getElementbyID

n°1093818
guillaume2​000
Posté le 23-05-2005 à 17:44:53  profilanswer
 

Bonjour à tous.
 
Voilà j'ai trouvé un script sur Internet, qui était marqué comme : Non fonctionnel sous Firefox | Fonctionne sous IE.
 
Après réécriture partiel du code, j'ai enfin pu le faire fonctionner sous Firefox et IE en même temps.
Mais seulement, la console javascript m'indique des warning à en saturer son buffer...
 
Et le warning est : La propriété non standard "document.all" a été utilisée. Veuilliez le remplacer par document.getElementbyID, standard du W3C
Ligne 56.
 
 
Donc moi je suis pas chiant, je veux bien changer, mais le problème, c'est que je n'arrive pas à faire les changements.
 
Voici le javascript auquel je fais appel.
 

Code :
  1. var ftx=640;
  2. var fty=480;
  3. var fpx=0;
  4. var fpy=0;
  5. var fpxf=0;
  6. var fpxc=0;
  7. var tempobe=0;
  8. var toclose=0;
  9. function beWindow(fpx,fpy,ftx,fty,ftitre,fichier) {
  10. var ftxb=220;
  11. var hide="hidden";
  12. fchaine=''
  13. +'<div id="fenetre" style="position:absolute;visibility:hidden;z-index:50;top:'+fpy+'px;left:'+fpx+'px;width:'+ftx+'px;height:'+fty+'px;bgcolor:#0000ff;">'
  14. +'<div id="window" style="position:absolute;z-index:50;top:21px;left:0px;width:'+(ftx)+'px;height:'+(fty)+'px;">'
  15. +'<div id="hg" style="position:absolute;z-index:50;top:0px;left:0px;width:6px;height:6px;">'
  16. +'<img src="images/hg.jpg" width="6" height="6"></div>'
  17. +'<div id="hd" style="position:absolute;z-index:50;top:0px;left:'+(ftx-6)+'px;width:6px;height:6px;">'
  18. +'<img src="images/hd.jpg" width="6" height="6"></div>'
  19. +'<div id="bg" style="position:absolute;z-index:50;top:'+(fty-6)+'px;left:0px;width:6px;height:6px;">'
  20. +'<img src="images/bg.jpg" width="6" height="6"></div>'
  21. +'<div id="bd" style="position:absolute;z-index:50;top:'+(fty-6)+'px;left:'+(ftx-6)+'px;width:6px;height:6px;">'
  22. +'<img src="images/bd.jpg" width="6" height="6"></div>'
  23. +'<div id="b" style="position:absolute;z-index:50;top:0px;left:6px;width:1px;height:6px;">'
  24. +'<img src="images/b.jpg" width="'+(ftx-10)+'" height="6"></div>'
  25. +'<div id="h" style="position:absolute;z-index:50;top:'+(fty-6)+'px;left:6px;width:1px;height:6px;">'
  26. +'<img src="images/h.jpg" width="'+(ftx-10)+'" height="6"></div>'
  27. +'<div id="d" style="position:absolute;z-index:50;top:6px;left:0px;width:6px;height:1px;">'
  28. +'<img src="images/d.jpg" width="6" height="'+(fty-10)+'"></div>'
  29. +'<div id="g" style="position:absolute;z-index:50;top:6px;left:'+(ftx-6)+'px;width:6px;height:1px;">'
  30. +'<img src="images/g.jpg" width="6" height="'+(fty-10)+'"></div>'
  31. +'</div>'
  32. +'<div id="titre" style="position:absolute;z-index:50;top:1px;left:0px;width:'+(ftx)+'px;height:21px;">'
  33. +'<table CELLPADDING=0 CELLSPACING=0 border=0 width="'+(ftxb)+'" height="21">'
  34. +'<tr><td background="images/tm.jpg"><FONT FACE="verdana" SIZE=1>'
  35. +'<B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+ftitre+'</B></FONT>'
  36. +'</td></tr></table>'
  37. +'<div style="position:absolute;z-index:50;top:0px;left:0px;">'
  38. +'<a href="#" onclick="javascript:return closebe();">'
  39. +'<IMG src="images/tg.jpg" BORDER=0 WIDTH=21 HEIGHT=21></A></div>'
  40. +'<div style="position:absolute;z-index:50;top:0px;left:'+(ftxb-4)+'px;">'
  41. +'<IMG src="images/td.jpg" BORDER=0 WIDTH=4 HEIGHT=21></div>'
  42. +'</div>'
  43. +'<div id="interieur" style="position:absolute;z-index:50;top:27px;left:6px;width:'+(ftx-12)+'px;height:'+(fty-12)+'px;">'
  44. +'<table width="50%" CELLSPACING=0 CELLPADDING=0 height="50%"><tr><td bgcolor="#FFFFFF" valign="top" align="center"><iframe name="inbeos" TOP=0 LEFT=0 WIDTH='+(ftx-12)+' HEIGHT='+(fty-12)+' border=0 FRAMEBORDER=0 scrolling=AUTO src="'+fichier+'"></iframe></td></tr></table>'
  45. +'</DIV>'
  46. +'</div>'
  47. +'</div>'
  48. document.write(fchaine);
  49. }
  50. function slidebe() {
  51. fpx+=fpxc;
  52. if ((fpx>fpxf) && (toclose==0)) {fpx=fpxf;fpxc=0;}
  53. if (toclose==1) {fpxc=fpxc-15;}


document.all.fenetre.style.left=fpx;

Code :
  1. if (fpx<-700) {
  2. fpxc=0;fpx=700;toclose=0;
  3. inbeos.location.href="vide.htm";
  4. document.all.fenetre.style.visibility="hidden";
  5. }
  6. tempobe=setTimeout('slidebe();',5);
  7. }
  8. function apercu(fichier)
  9. {
  10. self.clearTimeout();self.clearInterval();
  11. document.all.fenetre.style.top=document.body.scrollTop+(document.body.clientHeight/2)-190;
  12. document.all.fenetre.style.left=-700;fpx=-700;fpxf=(document.body.clientWidth/2)-320;fpxc=100;toclose=0;
  13. document.all.fenetre.style.visibility="visible";
  14. inbeos.location.href=fichier;
  15. }
  16. function closebe() {
  17. fpxc=20;toclose=1;
  18. return false;
  19. }
  20. beWindow(0,0,640,380,"Nom du site","vide.htm" );
  21. slidebe();


 
Voilà il m'indique le premier warning là, en rouge, mais bon, vu que la syntaxe est réutilisé par la suite, je me doute qu'en corrigeant celle là, faudra que je corrige le reste.
 
Merci d'avance de vos éventuelles réponses.
 
Guillaume


Message édité par guillaume2000 le 23-05-2005 à 17:46:15
mood
Publicité
Posté le 23-05-2005 à 17:44:53  profilanswer
 

n°1093940
robbyone
Non pas !
Posté le 23-05-2005 à 18:53:55  profilanswer
 

document.all.fenetre signifie mot à mot qu'il va chercher l'id fenetre dans tout de document.
A partir de cette définition, la syntaxe recherchée sera donc :

Code :
  1. document.getElementById('fenetre').style.left = ...

n°1093993
gatsusat
Posté le 23-05-2005 à 19:49:06  profilanswer
 

mon dieu C koi ce code javascript ??  
ca te sert à koi ce truc moche ?

n°1094422
cerel
Posté le 24-05-2005 à 09:30:20  profilanswer
 

On va prendre le probleme d'une autre facon.
 
guillaume2 000 : Que veux-tu faire ?
 
Car je suis sur que l'on peut faire la meme chose de façon plus propre.
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  HTML/CSS

  [Javascript]remplacer document.all par document.getElementbyID

 

Sujets relatifs
[javascript] desactiver un onsubmit en cochant une case (formulaire)[JavaScript] Grammaire BNF
CSS et Javascript dans un include[XForms] Plusieurs modèles dans un document
[Résolu] javascript pour modifier un texte dans un <td>Javascript: pb dans mon code
URLEncoder et javascript:escape()Taglibs javascript
[CSS] Problème avec les div pour remplacer les tableaux[résolu] [javascript/css] placer une image après action
Plus de sujets relatifs à : [Javascript]remplacer document.all par document.getElementbyID


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR