Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preloader zdjecia, javascript
andixxx
post
Post #1





Grupa: Zarejestrowani
Postów: 104
Pomógł: 0
Dołączył: 1.06.2006
Skąd: Legnica

Ostrzeżenie: (0%)
-----


jak zrobic preloader do 1 pliku graficznego, ktory podczas wczytywania go pokaze w miejscu obrazka inny obrazek ?(np loading.gif)
i aby dzialal pod najpopularniejszymi przegladarkami typu ie ff opera etc

Ten post edytował andixxx 15.08.2006, 19:39:54
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
andixxx
post
Post #2





Grupa: Zarejestrowani
Postów: 104
Pomógł: 0
Dołączył: 1.06.2006
Skąd: Legnica

Ostrzeżenie: (0%)
-----


  1. <?php
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  3. <html>
  4. <head>
  5. <title>Image Preloader</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <script language="JavaScript" type="text/JavaScript">
  8. <!--
  9. window.onerror = doNothing;
  10. function doNothing(){
  11. return true;
  12. }
  13. preloader();
  14. var image1 = new Image;
  15. image1.src = "duze.jpg";
  16. var begin = true;
  17. image1.onload = picPlacer;
  18. var messages = new Array("Your images are loading","Your images are loading.","Your images are loading..","Your images are loading...","Your images are loading..","Your images are loading.");
  19. var counter = 0;
  20. function preloader(){
  21. if(begin==true)
  22. if(document.getElementById){
  23. document.getElementById("holder").innerHTML = "<font color="#000000">"+messages[counter]+"</font>";
  24. }else if(document.all&&!document.getElementById){
  25. document.all.holder.innerHTML = "<font color="#000000">"+messages[counter]+"</font>";
  26. }
  27. counter++;
  28. if(counter==6){
  29. counter = 0;
  30. }homer = setTimeout("preloader()",200);
  31. }
  32. function picPlacer(){
  33. if(document.getElementById){
  34. document.getElementById("picplacer").src = image1.src;
  35. document.getElementById("picplacer").style.height = "250";
  36. document.getElementById("holder").innerHTML='';
  37. }else if(document.all&&!document.getElementById){
  38. document.all.picplacer.src = image1.src;
  39. document.all.picplacer.style.height = "250";
  40. document.all.holder.innerHTML='';
  41. }
  42. clearTimeout(homer);
  43. }
  44. //-->
  45. </script>
  46.  
  47. </head>
  48.  
  49. <body>
  50. <table width="50%" border="0" align="center" style="font-family:Verdana,sans-serif;font-size:11px">
  51. <tr> 
  52. <td align="center" valign="top"><img src="spacer.gif" name="picplacer" id="picplacer"></td>
  53. </tr>
  54.  
  55. <tr> 
  56. <td align="left" valign="top"><span id="holder"> </span></td>
  57. </tr>
  58. </table>
  59. </body>
  60. </html>
  61. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 04:11