Horje

Full Example of A Taste of JavaScript

<p>JavaScript can change styles:</p>
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>My First JavaScript</h1>

<p id="demo">JavaScript can change the style of an HTML element.</p>

<script>
function myFunction() {
  document.getElementById("demo").style.fontSize = "25px"; 
  document.getElementById("demo").style.color = "red";
  document.getElementById("demo").style.backgroundColor = "yellow";        
}
</script>

<button type="button" onclick="myFunction()">Click Me!</button>

</body>
</html>

Output should be:

Full Example of A Taste of JavaScript



Single Articles
Basic Example of A Taste of JavaScriptHTML JavaScript
Full Example of A Taste of JavaScriptHTML JavaScript
JavaScript can change attributes:HTML JavaScript


Related Articles
What is HTML JavaScript HTML JavaScript
How to use The HTML <script> Tag HTML JavaScript
How to create A Taste of JavaScript HTML JavaScript
How to create The HTML <noscript> Tag HTML JavaScript

Type:
Html
Category:
Web Tutorial
Sub Category:
HTML JavaScript
Uploaded by:
Admin