Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Skrypt nie działa na serwerze
grzehotnik
post
Post #1





Grupa: Zarejestrowani
Postów: 76
Pomógł: 0
Dołączył: 8.01.2009

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


Witam
Zrobiłem stronę na której jest pokaz slajdów.
Na serwerze lokalnym wszystko jest ok a na serwerze online pokaz slajdów nie działa.
Czy funkcje JS muszą być deklarowane zaraz po body w html?
Ja napisałem po body jakies menu a później dopiero script i funkcje JS.
Czy może to być przyczynąquestionmark.gif

oto kod index.php:
  1. <?php
  2. require_once('funkcje_galerii.php');
  3.  
  4. wyswietl_naglowek_html();
  5. ?>
  6. <script language="JavaScript">
  7.  
  8.    // configuration structure
  9.    var A_TPL = {
  10.        // randomize the array each time page loads
  11.        'random' : false,
  12.        // number of transparency changes during the transition
  13.        //    increase for smoother transition, reduce for less CPU usage
  14.        'steps' : 20,
  15.        // transition duration in seconds
  16.        'transtime': .5,
  17.        // slide time in seconds
  18.        'slidetime': 3,
  19.        // width of the slide (optional)
  20.        'width' : 780,
  21.        // height of the slide (optional)
  22.        'height': 500,
  23.        // alt text for the image (optional)
  24.        'alt' : 'Grzegorz Buczylowski - fotogallery',
  25.        // css class assigned to the slide <img> (optional)
  26.        'css' : ''
  27.    };
  28.  
  29.    // list of images to display
  30.    var A_ITEMS = [<?php
  31.        $s_path = './img/';
  32.        $a_types = array ('jpg', 'gif', 'jpeg', 'png');
  33.        $a_images = array ();
  34.        $h_dir = opendir($s_path);
  35.        while ($s_file = readdir($h_dir)) {
  36.            $s_type = strtolower(substr(strrchr($s_file, '.'), 1));
  37.            if (in_array($s_type, $a_types))
  38.                array_push($a_images, "\n\t\t'$s_path$s_file'");
  39.        }
  40.        closedir($h_dir);
  41.        sort($a_images);
  42.        echo join(',', $a_images);
  43. ?>
  44.  
  45.    ];
  46.    // fader initialization    
  47.    var mySlideShow = new tFader (A_ITEMS, A_TPL);
  48.  
  49. </script>
  50. <?php
  51. wyswietl_stopke_html();
  52. ?>


i funkcja wyswietl nagłóek (część):

  1. <script language="JavaScript" src="./js/tFader.js"></script>
  2. <script type="text/javascript" src="./js/lightbox.js"></script>
  3. <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
  4. </head>
  5.  
  6. <body bgcolor="#000000">
  7.  
  8. <div id="calosc">
  9.  
  10.  <div id="menu">
  11.    <img src="logo.jpg" />
  12.    <a href="index.php">Home</a>&nbsp &nbsp
  13.    <a href="aboutme.php">Abaut me</a>&nbsp &nbsp
  14.    <a href="gallery.php">Gallery</a>&nbsp &nbsp
  15.    <a href="contact.php">Contact</a>
  16.  </div>
  17.  
  18.  <div id="ramka">
  19.  
  20. <?php
  21. }
  22. ?>


Dzięki za pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
leovandamon
post
Post #2





Grupa: Zarejestrowani
Postów: 41
Pomógł: 3
Dołączył: 5.01.2008
Skąd: Czwarty Świat

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


Wywołaj skrypt JS po załadowaniu DOM, tzn, kiedy przeglądarka załaduje ci stronę.

Na serwerze lokalnym wszystko chodzi szybko, z sieci są małe opóźnienia.
Najlepiej zapisz w funkcję i daj jakiś document.onload czy coś...


--------------------
Mój blog: http://test.dragonsheart.eu/
DH Corp: http://www.dhcorp.pl/
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 20.08.2025 - 05:52