Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript] getelements w linku
Legion
post
Post #1





Grupa: Zarejestrowani
Postów: 46
Pomógł: 1
Dołączył: 16.08.2008

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


Witam,

chciałbym aby po kliknięciu na link pokazał się div z dowolną zawartością zrobiłem to samo ale przy użyciu checkboxa i działa:

  1. <?php echo ('<div id="lzw" style="display: none">
  2.                  
  3.                  <table>
  4.                   <tr>
  5.                   <td>Jakiś tam tekst</td>
  6.                   </tr>
  7.                  </table>
  8.                </div>');
  9.            
  10.            
  11.            
  12. echo ('<table><td width="99"><div id="hgj" align="center" >
  13.    <form action="" method="POST">
  14.    <input type="checkbox" name="nazwa" value="wartość" onClick="document.getElementById('lzw').style.display = this.checked ? 'block' : 'none'" /> klik
  15.    </form>
  16.    </div></td></table> ');
  17.            
  18.            ?>



Z góry dziękuję (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
potreb
post
Post #2





Grupa: Zarejestrowani
Postów: 1 568
Pomógł: 192
Dołączył: 7.03.2005
Skąd: Warszawa

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


  1. <a href="#" onClick="document.getElementById('lzw').style.display = this.checked ? 'block' : 'none'">link</a>


Ten post edytował potreb 3.05.2009, 10:07:22
Go to the top of the page
+Quote Post
Legion
post
Post #3





Grupa: Zarejestrowani
Postów: 46
Pomógł: 1
Dołączył: 16.08.2008

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


Cytat(potreb @ 3.05.2009, 11:07:03 ) *
  1. <a href="#" onClick="document.getElementById('lzw').style.display = this.checked ? 'block' : 'none'">link</a>



Też tak próbowałem i nie działa.
Go to the top of the page
+Quote Post
potreb
post
Post #4





Grupa: Zarejestrowani
Postów: 1 568
Pomógł: 192
Dołączył: 7.03.2005
Skąd: Warszawa

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


  1. <a href='javascript: show()'>pokaż</a>
  2.  
  3. <div id='mojdiv' style='display:none'>
  4. jakis tejstssf rserere
  5. </div>
  6.  
  7. <script type="text/javascript">
  8. function show(){
  9. var mojdiv= document.getElementById('mojdiv')
  10. if (mojdiv.style.display == 'none') {
  11. mojdiv.style.display = 'block'
  12. } else {
  13. mojdiv.style.display = 'none'
  14. }
  15. }


Ten post edytował potreb 3.05.2009, 10:22:27
Go to the top of the page
+Quote Post
Legion
post
Post #5





Grupa: Zarejestrowani
Postów: 46
Pomógł: 1
Dołączył: 16.08.2008

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


Działa wielkie dzięki (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

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: 23.08.2025 - 04:04