Zmiana stylu elementu <div id="okno">
Element: <div id="okno">
document.getElementById("okno").style.własność = ...
<div id="okno"> <h2> ... </h2> </div>
Fragment kodu HTML (przyciski)
<div id="btn"> <button onclick="styl_1()">Styl 1</button> <button onclick="styl_2()">Styl 2</button> <button onclick="location.href='03.html'">Start</button> </div>
Funkcje z pliku skrypt.js
function styl_1(){ document.getElementById("okno").style.color = "white"; document.getElementById("okno").style.backgroundColor = "black"; document.getElementById("okno").style.textAlign = "right"; document.getElementById("okno").style.borderRadius = "25px 0"; } function styl_2(){ document.getElementById("okno").style.color = "blue"; document.getElementById("okno").style.backgroundColor = "lightblue"; document.getElementById("okno").style.textAlign = "center"; document.getElementById("okno").style.borderRadius = "30px"; }