Se connecter avec
S'enregistrer | Connectez-vous

Fonction incompatibles ???

Dernière réponse : dans Programmation

Salut !

Pourriez-vous me dire pourquoi, quand je desinhibe verti_scroller(), tableau_colorer() ne fonctionne plus ?

  1. <style type="text/css">
  2. #verti_div
  3. {
  4. position:absolute;
  5. width :100%;
  6. height:265%;
  7. }
  8. h1
  9. {
  10. margin-top:15%;
  11. line-height:125%;
  12. margin-left:0;
  13. font-size:211%;
  14. text-align:center;
  15. }
  16. </style>
  17.  
  18. <div id="verti_div">
  19. <h1 style="margin-top: 38%">Dominique Braschi-Blondeau<br>présente</h1>
  20. <h1>une production de</h1>
  21. <h1>Cosmic Village Productions</h1>
  22. <h1>réalisée par</h1>
  23. <h1>Stéphane Lembaumeur</h1>
  24. </div>
  25.  
  26. <script type="text/JavaScript">
  27.  
  28. function verti_scroller()
  29. {
  30. incrementeur-=pas
  31. document.getElementById('verti_div').style.top=incrementeur
  32. if(incrementeur>-1.5*window.innerHeight)
  33. setTimeout('verti_scroller()', laps)
  34. else
  35. alert(document.getElementById('verti_div').style.top)
  36. }
  37.  
  38. function tableau_colorer()
  39. {
  40. if(t_colorer=='ok')
  41. {
  42. element_no=0
  43. elements_nombre=tableau.length
  44. while(element_no<elements_nombre)
  45. {
  46. element=tableau[element_no]
  47. position=element.offsetTop-document.body.scrollTop
  48.  
  49. if( 0 < position && position < window.innerHeight / 2 )
  50. taux = position / ( window.innerHeight / 2 )
  51.  
  52. else if( window.innerHeight / 2 <= position && position < window.innerHeight )
  53. taux = ( window.innerHeight - ( position * 1.1 ) ) / ( window.innerHeight / 2 )
  54.  
  55. else
  56. taux = 0
  57.  
  58. delta_r = parseInt(coul_bord.slice(1, 3), 16) - parseInt(coul_mil.slice(1, 3), 16)
  59. delta_v = parseInt(coul_bord.slice(3, 5), 16) - parseInt(coul_mil.slice(3, 5), 16)
  60. delta_b = parseInt(coul_bord.slice(5, 7), 16) - parseInt(coul_mil.slice(5, 7), 16)
  61.  
  62. r_cour = parseInt( parseInt(coul_bord.slice(1, 3), 16) - ( taux * delta_r ) )
  63. v_cour = parseInt( parseInt(coul_bord.slice(3, 5), 16) - ( taux * delta_v ) )
  64. b_cour = parseInt( parseInt(coul_bord.slice(5, 7), 16) - ( taux * delta_b ) )
  65.  
  66. color_display(element)
  67. element_no++
  68. }
  69. setTimeout('tableau_colorer()', 100)
  70. }
  71. }
  72.  
  73. function color_display(objet) { objet.style.color = 'rgb(' + r_cour + ',' + v_cour + ',' + b_cour + ')' }
  74.  
  75. //incrementeur=0; pas=2; laps=1; verti_scroller();
  76.  
  77. coul_bord=document.bgColor; coul_mil=document.fgColor; t_colorer='ok';
  78. tableau=document.getElementsByTagName('h1'); tableau_colorer()
  79.  
  80. </script>


Merci de votre contribution !

Autres pages sur : fonction incompatibles

Lassé par la pub ? Créez un compte

En passant en Javascript, on doit mettre de points-virgule ";" à la fin des lignes...

Par exemple :

  1. # <script type="text/JavaScript">
  2.  
  3. function verti_scroller()
  4. {
  5. incrementeur-=pas;
  6. document.getElementById('verti_div').style.top=incrementeur;
  7. if(incrementeur>-1.5*window.innerHeight)
  8. setTimeout('verti_scroller()', laps);
  9. else
  10. alert(document.getElementById('verti_div').style.top);
  11. }
  12.  
  13. function tableau_colorer()
  14. {
  15. if(t_colorer=='ok')
  16. {
  17. element_no=0;
  18. elements_nombre=tableau.length;
  19. while(element_no<elements_nombre)
  20. {
  21. element=tableau[element_no];
  22. position=element.offsetTop-document.body.scrollTop;
  23.  
  24. if( 0 < position && position < window.innerHeight / 2 )
  25. taux = position / ( window.innerHeight / 2 );
  26.  
  27. else if( window.innerHeight / 2 <= position && position < window.innerHeight )
  28. taux = ( window.innerHeight - ( position * 1.1 ) ) / ( window.innerHeight / 2 );
  29.  
  30. else
  31. taux = 0;
  32.  
  33. delta_r = parseInt(coul_bord.slice(1, 3), 16) - parseInt(coul_mil.slice(1, 3), 16);
  34. delta_v = parseInt(coul_bord.slice(3, 5), 16) - parseInt(coul_mil.slice(3, 5), 16);
  35. delta_b = parseInt(coul_bord.slice(5, 7), 16) - parseInt(coul_mil.slice(5, 7), 16);
  36.  
  37. r_cour = parseInt( parseInt(coul_bord.slice(1, 3), 16) - ( taux * delta_r ) );
  38. v_cour = parseInt( parseInt(coul_bord.slice(3, 5), 16) - ( taux * delta_v ) );
  39. b_cour = parseInt( parseInt(coul_bord.slice(5, 7), 16) - ( taux * delta_b ) );
  40.  
  41. color_display(element);
  42. element_no++;
  43. }
  44. setTimeout('tableau_colorer()', 100);
  45. }
  46. }
  47.  
  48. function color_display(objet) { objet.style.color = 'rgb(' + r_cour + ',' + v_cour + ',' + b_cour + ')'; }
  49.  
  50. //incrementeur=0; pas=2; laps=1; verti_scroller();
  51.  
  52. coul_bord=document.bgColor; coul_mil=document.fgColor; t_colorer='ok';
  53. tableau=document.getElementsByTagName('h1'); tableau_colorer();
  54.  
  55. </script>
Lassé par la pub ? Créez un compte