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 Random

JS Date Functions


JS Assignment

JS Question-Answer

Page Stats

Visitor: 406

CSS Styling using JavaScript

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

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