Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sakrij-pokazi
Author Message
Gogy Offline
____
*

Posts: 2,379
Joined: Feb 2006
Post: #11
RE: Sakrij-pokazi
Code:
<html>
<head>
<script type="text/javascript">
function prikazi()
{
if(document.getElementById("neko-polje").style.display=="none")
    {
        document.getElementById("neko-polje").style.display="block";
    }
    
else if(document.getElementById("neko-polje").style.display="block")
{
    document.getElementById("neko-polje").style.display="none";
}
}
</script>
</head>
<body>
<div id="neko-polje" style="display:none;">
text
</div>
<a href="#" onClick="prikazi();">Prikazi / Sakrij</a>
</body>
</html>

Pravila foruma | Twitter - Facebook - Google+ |
27-09-2008 02:02 PM
Visit this user's website Find all posts by this user Quote this message in a reply
zero Offline
Forumaš
***

Posts: 461
Joined: Jan 2008
Reputation: 10
Post: #12
RE: Sakrij-pokazi
Gogy Wrote:
Code:
<html>
<head>
<script type="text/javascript">
function prikazi()
{
if(document.getElementById("neko-polje").style.display=="none")
    {
        document.getElementById("neko-polje").style.display="block";
    }
    
else if(document.getElementById("neko-polje").style.display="block")
{
    document.getElementById("neko-polje").style.display="none";
}
}
</script>
</head>
<body>
<div id="neko-polje" style="display:none;">
text
</div>
<a href="#" onClick="prikazi();">Prikazi / Sakrij</a>
</body>
</html>

Hvala puno Palac-gore .

BTW. Jos nisi uveo ono da ti mogu dati +. Deda Happy

Brzo. Jeftino. Kvalitetno. Izaberi dva!
27-09-2008 04:51 PM
Find all posts by this user Quote this message in a reply
Gogy Offline
____
*

Posts: 2,379
Joined: Feb 2006
Post: #13
RE: Sakrij-pokazi
Meni je + što si ti s nama Namigivanje

Pravila foruma | Twitter - Facebook - Google+ |
27-09-2008 06:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
makifgr Offline
Novi korisnik
*

Posts: 4
Joined: Jul 2009
Reputation: 0
Post: #14
RE: Sakrij-pokazi
super iskoristio sam je na blogu gdje sam objavio 12 tekstova pjesama jednog novog albuma
inace bi mi tekstovi puno produzili blog a ovako sakriveno dobro se uklopilo a ko hoce da vidi tekstove neka klikne
meni je pomogla skripta

makifgr
31-07-2009 10:44 PM
Find all posts by this user Quote this message in a reply
r0tring Offline
Redoviti posjetitelj
**

Posts: 237
Joined: Apr 2009
Reputation: 11
Post: #15
RE: Sakrij-pokazi
Sorry zbog dizanja stare teme, ali imam jedno pitanjce u vezi ove skripte "Sakrij-Pokazi".

Zanima me kako da ovu skriptu prilagodim tako da dok text nije prikazan stoji link Prikazi, a kad kliknemo na taj link otvori se text i sad stoli link Sakrij!

Ukratko da ne stoji uvijek Sakrij/Pokazi!

Hvala!
29-09-2009 01:12 PM
Find all posts by this user Quote this message in a reply
zero Offline
Forumaš
***

Posts: 461
Joined: Jan 2008
Reputation: 10
Post: #16
RE: Sakrij-pokazi
scroler Wrote:Sorry zbog dizanja stare teme, ali imam jedno pitanjce u vezi ove skripte "Sakrij-Pokazi".

Zanima me kako da ovu skriptu prilagodim tako da dok text nije prikazan stoji link Prikazi, a kad kliknemo na taj link otvori se text i sad stoli link Sakrij!

Ukratko da ne stoji uvijek Sakrij/Pokazi!

Hvala!

Koristi getElementById() metodu... uglavnom, to bi izgledalo ovako:

Code:
<html>
<head>
<script type="text/javascript">
function prikazi()
{
if(document.getElementById("neko-polje").style.display=="none")
    {
        document.getElementById("neko-polje").style.display="block";
        document.getElementById("link").innerHTML = "Sakrij";
    }
    
else if(document.getElementById("neko-polje").style.display="block")
{
    document.getElementById("neko-polje").style.display="none";
        document.getElementById("link").innerHTML = "Prikazi";
}
}
</script>
</head>
<body>
<div id="neko-polje" style="display:none;">
text
</div>
<a href="#" onClick="prikazi();" id="link">Prikazi</a>
</body>
</html>

Malo pogledaj o innerHTML na w3schools.

Brzo. Jeftino. Kvalitetno. Izaberi dva!
29-09-2009 03:55 PM
Find all posts by this user Quote this message in a reply
r0tring Offline
Redoviti posjetitelj
**

Posts: 237
Joined: Apr 2009
Reputation: 11
Post: #17
RE: Sakrij-pokazi
To je to!
Hvala puno! Namigivanje
29-09-2009 04:16 PM
Find all posts by this user Quote this message in a reply
r0tring Offline
Redoviti posjetitelj
**

Posts: 237
Joined: Apr 2009
Reputation: 11
Post: #18
RE: Sakrij-pokazi
Evo mene opet!

Samo me jos zanima sta ako zelim ovo primjeniti na vise div-ova?
Moram za svaki pisati posaban JS ili?
01-10-2009 06:12 PM
Find all posts by this user Quote this message in a reply
zero Offline
Forumaš
***

Posts: 461
Joined: Jan 2008
Reputation: 10
Post: #19
RE: Sakrij-pokazi
Ne... Imas funkcije :). Kod:
Code:
<html>
<head>
<script type="text/javascript">
function prikazi(idpolja, kojilink)
{
if(document.getElementById(idpolja).style.display=="none")
    {
        document.getElementById(idpolja).style.display="block";
        document.getElementById(kojilink).innerHTML = "Sakrij " + idpolja;
    }
    
else if(document.getElementById(idpolja).style.display="block")
{
    document.getElementById(idpolja).style.display="none";
        document.getElementById(kojilink).innerHTML = "Prikazi " + idpolja;
}
}
</script>
</head>
<body>
<div id="neko-polje1" style="display:none;">
text
</div>
<a href="#" onClick="prikazi('neko-polje1', 'link1');" id="link1">Prikazi neko-polje1</a>
<div id="neko-polje2" style="display:none;">
text2122231
<br />dsasad
</div>
<br /><a href="#" onClick="prikazi('neko-polje2', 'link2');" id="link2">Prikazi neko-polje2</a>
</body>
</html>

Znaci u funkcije pozes spremati podatke, tj. u varijable. Npr:
Code:
nekafunkcija(varijabla)
{
alert(varijabla);
}
Taj kod mozes pozvati s:
Code:
<input type="button" onClick="nekafunkcija('blabla')" value="Napisi blabla" />
Ili sa:
Code:
<a href="#" onClick="nekafunkcija('proba')">Ispisi proba</a>

Uglavnom, funkcije pozivas s onClick, onLoad i slicnim, a postavljas ih sa:
funkcija(varijabla)
{
//kod
}
....

Brzo. Jeftino. Kvalitetno. Izaberi dva!
(This post was last modified: 03-10-2009 08:36 PM by zero.)
03-10-2009 08:32 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)