Change the border of an element in Javascript

Description

Change the border of an element in Javascript

Example


<!DOCTYPE HTML> 
<html> 
    <body> 
        <p id="myText"> 
            <span id="mySpan">HTML</span> 
            This is a test.<!--from ww  w .  j a va  2s.com-->
            This is a test.
        </p> 
        <p id="myPara"> 
            This is a test.
            This is a test.
            This is a test.
        </p> 
        <script> 
            var elems = document.getElementsByTagName("p"); 
            for (var i = 0; i < elems.length; i++) { 
              elems[i].style.border = "medium double black"; 
            } 
            
        </script> 
    </body> 
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window