Knowledge Walls
John Peter
Pune, Maharashtra, India
How to use css styles using javascript with Example
Style property 
style is a property of element object or node object in javascript.

document.getElementById("id_name").style.color = "red";
        <title>getElementsByName example</title>
        <script type="text/javascript">
            function applyCSSStyle(className,cssname,cssvalue){
                var elements = document.getElementsByClassName(className);
                for (var index in elements){
                   if (!isNaN(index))
                   elements[index].style[cssname] = cssvalue;
            window.onload = function(){
        <div class="go_green">
           Green Color
        <div class="go_green go_background_red">
           Red background Color with green text
Demo & Output 
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details