Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]Jak zrobić menu przewijane za pomocą JS, Jak zrobić menu przewijane za pomocą JS
zielu001
post
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 3
Dołączył: 15.08.2009

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


Witam, chcę zrobić skrypt który by pokazywał tekst z Array na divie po kliknięciu obrazka > Dawało do następnego a po < cofało do poprzedniego..

mam takie coś:
  1.  
  2.  
  3. var tekst = Array("item1", "item2", "item3", "item4", "item5" );
  4. var linki = Array("poka_1", "poka_2", "poka_3", "poka_4", "poka_5" );
  5. var ktore = 0;
  6. function Przewin(ok)
  7. {
  8. if(ok == 0)
  9. {
  10. ok+=1;
  11. document.write(tekst[ktore]);
  12. }
  13. if(ok == 1)
  14. {
  15. ok-=1;
  16. document.write(tekst[ktore]);
  17. }
  18. }
  19.  
  20. <a href="#" onclick="Przewin(1)"><img href="cos"></a>
  21. <a href="#" onclick="Przewin(0)"><img href="cos2"></a>
  22.  


Lecz to nie działa, chciał bym to też zrobić żeby to się wyświetlało w divie jakimś np. pole..
Proszę o pomoc!
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
zielu001
post
Post #2





Grupa: Zarejestrowani
Postów: 87
Pomógł: 3
Dołączył: 15.08.2009

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


Tutaj dałem tylko przykład, a tak mam na prawde:

Kod
<html lang="POL">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <title> CS-Rewolucja.pl - Sklep </title>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <meta name="robots" content="noodp, noydir, index, follow" />
        <meta name="googlebot" content="noodp, noydir, index, follow" />
        <meta name="audience" content="all" />
        <meta name="language" content="pl" />
        <meta name="resource-type" content="document" />
        <meta name="copyright" content="cs-rewolucja.pl" />
        <meta name="revisit-after" content="1" />
        <meta name="distribution" content="global" />
        <meta name="location" content="Poland" />
        <script language="javascript">
function Sol(){
var tekst = Array("item1", "item2", "item3", "item4", "item5" );
var linki = Array("poka_1", "poka_2", "poka_3", "poka_4", "poka_5" );
var ktore = 0;
function Przewin(ok)
{
      if(ok == 0)
      {
           ktore+=1;
           document.getElementById('ss').innerHTML = tekst[ktore];
      }
      if(ok == 1)
      {
           ktore-=1;
         document.getElementById('ss').innerHTML = tekst[ktore];
      }
}}
    </script>
    </head>
<body onload="Sol();">
    <center><a href="http://cs-rewolucja.pl" border="0"><img src="images/logo.png"></a></center>
    <div id="bg">
        <div id="ss"></div>
    </div>
    <div id="lewo">
        <a onclick="Przewin(1);"><img border="0" src="images/lewo.png"/></a>
    </div>
    <div id="prawo">
        <a onclick="Przewin(0);"><img border="0" src="images/prawo.png"/></a>
    </div>
</body>
</html>



w <A> nie ma java script:void(0); bo jak dałem to mi pokazywało błąd że nie ma takiej strony ;./

Ten post edytował zielu001 8.09.2010, 18:09:43
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: 5.10.2025 - 03:32