Se connecter avec
S'enregistrer | Connectez-vous

aide pour script

Dernière réponse : dans Programmation

bonjour a tous,
j'ai un script pour afficher une barre de chargement sur mon site , malheureusement je n'arrive pas a la centrer sur mon site ou quand j'y parvient celle ci ne charge plus j'ai essayé plusieurs methode mes rien a faire
quelqu'un serai t'il m'aidez
merci d'avance

  1. <head>
  2. <script>
  3. <!--
  4. // Copyright Peter Gehrig et Urs Dudli at <a href="http://www.24fun.com" target="_blank">www.24fun.com</a>
  5. // If you add this script to a script-archive
  6. // you have to add a link to <a href="http://www.24fun.com" target="_blank">www.24fun.com</a> on the page
  7. // La largeur de la barre en pixels.
  8. var loadbar_width=200
  9. // La hauteur de la barre en pixels.
  10. var loadbar_height=18
  11. // La position horizntale de la barre.
  12. var loadbar_left=40
  13. // La position verticale de la barre.
  14. var loadbar_top=50
  15. // Le temps du décompte (en secondes).
  16. var countdown_time=20
  17. // L'url de destination après le décompte
  18. var redirection_url="http://"
  19.  
  20. // ////////////////////////////////////////////////////
  21. countdown_time=countdown_time*1000
  22. var pause=20
  23.  
  24. var i_loop=0
  25. var dblwidth=2*loadbar_width
  26. var clipleft=loadbar_width
  27. var clipright=dblwidth
  28. var cliptop=0
  29. var clipbottom=loadbar_height
  30.  
  31. var getmilli_start
  32. var getmilli_loop
  33. var getmilli_total
  34. var waydone
  35.  
  36. function initiate() {
  37. var time=new Date()
  38. getmilli_start=time.getTime()
  39. if (document.all) {
  40. document.all.loadbar.style.posLeft=loadbar_left-loadbar_width
  41. document.all.loadbar.style.posTop=loadbar_top
  42. document.all.loadbar.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  43. moveloadbar()
  44. }
  45. else if (document.layers) {
  46. document.loadbar.left=loadbar_left-loadbar_width
  47. document.loadbar.clip.left=loadbar_width
  48. document.loadbar.top=loadbar_top
  49. document.loadbar.clip.right=dblwidth
  50. document.loadbar.clip.top=0
  51. document.loadbar.clip.bottom=loadbar_height
  52. moveloadbar()
  53. }
  54. else {
  55. document.location.href=redirection_url
  56. }
  57. }
  58.  
  59. function moveloadbar() {
  60. var time=new Date()
  61. var getmilli_loop=time.getTime()
  62. getmilli_total=getmilli_loop-getmilli_start
  63. waydone=Math.floor(loadbar_width/countdown_time*getmilli_total)
  64. if (clipleft>=0) {
  65. if (document.all) {
  66. document.all.loadbar.style.posLeft=loadbar_left-loadbar_width+waydone
  67. clipleft=loadbar_width-waydone
  68. clipright=-waydone+2*loadbar_width
  69. document.all.loadbar.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  70. }
  71. if (document.layers) {
  72. clipleft=loadbar_width-waydone
  73. document.loadbar.left=loadbar_left-loadbar_width+waydone
  74. document.loadbar.clip.left=loadbar_width-waydone
  75. document.loadbar.clip.right=-waydone+2*loadbar_width
  76. document.loadbar.clip.top=0
  77. document.loadbar.clip.bottom=loadbar_height
  78. }
  79. var timer=setTimeout("moveloadbar()",pause)
  80. }
  81. else {
  82. clearTimeout(timer)
  83. document.location.href=redirection_url
  84. }
  85. }
  86. // -->
  87. </script>
  88. </head>
  89. <body>
  90. <body onLoad="initiate()">
  91. </body>
  92. <div id="loadbar" style="position:absolute;top:-2000px">
  93. <script>
  94. document.write("<img src='loadbar.gif' width='"+dblwidth+"' height='"+loadbar_height+"'>")
  95. </script>
  96. </div>

Autres pages sur : aide script

Lassé par la pub ? Créez un compte

je sais lire merci
et désolé mais une barre d'avancement en js qui ne charge rien
puis redirige l'utilisateur vers une autre page ca sert a rien ...

et je confirme, il y a moyen de faire beaucoup plus simple ...

bah si ca me sert justement pour une page d'intro je ne suis pas codeur je connais un peu mes pas plus je prend ce que je trouve le code n'est pas de moi je cherche a la centre dans ma page , meme si je met
  1. <div id="loadbar" style="position:center;top:-2000px">

cela me la centre met le chargement ne ce fait plus
Lassé par la pub ? Créez un compte