Javascript – Common Methods

Change text elements

document.getElementById("demo").innerHTML = "Hello JavaScript";

 

Change image elements

document.getElementById('myImage').src='pic_bulboff.gif'

 

Change css

document.getElementById("demo").style.fontSize = "35px";

 

Change display style

document.getElementById("demo").style.display = "none";

 

Print the window

<button onclick="window.print()">Print this page</button>