Programs in JavaScript
4. Program to change style of a text at runtime.<script> function chngstyle() { document.getElementById('div1').style.color = "Red" document.getElementById('div1').style.backgroundColor = "yellow" document.getElementById('div1').style.width = "100" document.getElementById('div1').style.height = "100" } </script> <div id="div1"> Welcome to all </div> <input type="button" value="Click" onclick="chngstyle()">Output :
Welcome to all
Father of JavaScript