
<html> <head> <style type="text/css"> #d2 { background: orange; display: none; } #d3 { background: red; display: block; } </style> </head> <body> <script type="text/javascript"> function zmien() { el = document.getElementById("d2"); e2 = document.getElementById("d3"); if (el.style.display == "block") { el.style.display = "none"; e2.style.display = "block"; } else { el.style.display = "block"; e2.style.display = "none"; } } setTimeout("zmien()",2000); </script> </body> </html>
<html> <head> <style type="text/css"> #d2 { background: orange; display: none; } #d3 { background: red; display: block; } </style> </head> <body> <script type="text/javascript"> function zmien() { el = document.getElementById("d2"); e2 = document.getElementById("d3"); if (el.style.display == "block") { el.style.display = "none"; e2.style.display = "block"; } else { el.style.display = "block"; e2.style.display = "none"; } } var uchwyt = setInterval("zmien()",2000); </script> <input type="button" value="zatrzymaj" onclick="clearInterval(uchwyt);" /> </body> </html>
<input type="button" value="wznów" onclick="setInterval('zmien()',500);" />