Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 15.12.2011 Ostrzeżenie: (0%)
|
co wpisać w warunek ifa żeby po kliknięciu przycisku o id p2/p3 wywoływała sie instrukcja?(IMG:style_emoticons/default/questionmark.gif)
Kod <html>
<head> <script type="text/javascript"> var c=1; function kol() { var x = Math.round(100*Math.random()); document.getElementById('lol').style.backgroundColor='rgb(' + x + ',' + x + ',' + x + ')'; } function zmiana() { if(??) c=c+5; document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')'; if(??) c=c-5; document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')'; } </script> <style> #lol{ position:fixed; left:100px; top:150px; } #lol1{ left:250px; top:0px; position:relative; } </style> </head> <body> <input type="button" value="Ustaw kolor" onclick="kol()"/> <input id="p2" type="button" value="Jasniej" onclick="zmiana()"/> <input id="p3" type="button" value="Ciemniej" onclick="zmiana()"/> <div id="lol" style="width:200px;height:200px;border:1px solid blue;"> <div id="lol1" style="width:200px;height:200px;border:1px solid blue;"> </div> </body> </html> Ten post edytował olipo 15.12.2011, 12:50:04 |
|
|
|
olipo [JavaScript] if (po kliknięciu przycisku) 15.12.2011, 12:44:23
phpion Proszę o dodanie odpowiedniego bbcode - w przeciwn... 15.12.2011, 12:46:53
kamil4u EDIT2:
Musisz skorzystać z target i srcElement(dla... 15.12.2011, 12:56:58 ![]() ![]() |
|
Aktualny czas: 25.12.2025 - 00:11 |