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()">
<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()">
In JavaScript same variable can be used for different types. True or False?
Anonymous Quiz
69%
True
31%
False
🔰 CSS Basic Quiz
Browser adds some default stylesheets. True or False?
Browser adds some default stylesheets. True or False?
Anonymous Quiz
80%
True
20%
False
8 best CSS Sliders for web developers to enhance your projects 👇👇