JavaScript Tutorial

Define JavaScript

JS Arithmetic Exercise

JavaScript Comment

JavaScript Variable

JavaScript Operators

Conditional Statements

Logical Operators

JavaScript Slider

JS Login Form

JS Popup Boxes

JavaScript Loops

JavaScript Arrays

JS Mouse Events

JS Keyboard Events

Styling Elements

External JavaScript

JS Noscript Tag

JS String Functions

JS Math Functions

JS Date Functions

JS Theme Changer

JS Assignment

Page Stats

Visitor: 86

CSS Styling using JavaScript

Example 1: Change the style of an HTML elements using javascript.

<html> 
   <script> 
      function myFunction() 
      { 
         var x = document.getElementById("demo"); 
         x.style.fontSize = "25px"; 
         x.style.color = "red"; 
      } 
   </script> 
   <body> 
      <p id="demo">
         JavaScript can change the style of an HTML element.
      </p> 
      <button type="button" onclick="myFunction()">
         Click Me!
      </button> 
   </body> 
</html>