Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Zmiana Wielkości obrazku
Dawior
post
Post #1





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 15.03.2008

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


Witam mam taki problem otóż mam taki skrypt:

  1. <script type="text/javascript">
  2. function podmiana(nr,zmien) {
  3. if (zmien == "nowe") {
  4. document.getElementById('obrazek'+nr).width = '770';
  5. document.getElementById('obrazek'+nr).width = '1000';
  6. } else if (zmien == "stare") {
  7. document.getElementById('obrazek'+nr).width = '100';
  8. document.getElementById('obrazek'+nr).width = '100';
  9. }
  10. }

  1. <a href='javascript:void(0);' onclick='podmiana(1,\"nowe\")'
  2. onmouseout='podmiana(1,\"stare\");'><img src='http://jakisserwer.pl/jakisobrazek.jpg' id='obrazek1' style='border:0'></a>


Jak zrobić żeby liczby
  1. onclick='podmiana(1,\"nowe\")'

  1. onmouseout='podmiana(1,\"stare\")

  1. id='obrazek1'


Zmieniały się automatycznie? bardo proszę o odpowiedź i z góry dziękuję.

Ten post edytował Dawior 3.01.2009, 13:20:48
Go to the top of the page
+Quote Post
pinochet
post
Post #2





Grupa: Zarejestrowani
Postów: 120
Pomógł: 12
Dołączył: 9.10.2008
Skąd: Tricity.Rumia()

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


na przykład tak:
  1. <script type="text/javascript">
  2. function podmiana(cos,zmien) {
  3. if (zmien == "nowe") {
  4. cos.firstChild.width = '500';
  5. } else if (zmien == "stare") {
  6. cos.firstChild.width = '100';
  7. }
  8. }
  9. </head>
  10. <a href="javascript:void(0);" onclick="podmiana(this,'nowe')"
  11. onmouseout="podmiana(this,'stare');"><img src="http://forum.php.pl/uploads/av-6040.jpg" id="obrazek1" style="border:0"></a>
  12. </body>
  13. </html>
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 - 12:07