Fragment kodu HTML
<div id="menu"> <button onclick="location.href='index.html'">Start</button> <button onclick="tekst_1()">Tekst 1</button> <button onclick="tekst_2()">Tekst 2</button> <button onclick="styl_1()">Styl 1</button> <button onclick="styl_2()">Styl 2</button> </div>
Plik: skrypt.js
function tekst_1(){ document.getElementById("okno").innerHTML = "<h1>Witaj Świecie!</h1>"; } function tekst_2(){ document.getElementById("okno").innerHTML = "<h1>Hello World!</h1>"; } function styl_1(){ document.getElementById("okno").style.color = "white"; document.getElementById("okno").style.backgroundColor = "black"; } function styl_2(){ document.getElementById("okno").style.color = "blue"; document.getElementById("okno").style.backgroundColor = "white"; }