Hi Willy
The style object can be used to not only set but get information too. So to reverse your statement, try:
var myBorder = document.getElementById('id').style.border; The string returned by style.border should look much like your example "5px solid blue", with the border's width, style, and color in a single line.
It's often more convenient to access each attribute individually. For border styles you can do so by going through the style.border property like this:
var myColor = document.getElementById('id').style.border.color;
var myStyle = document.getElementById('id').style.border.style;
var myWidth = document.getElementById('id').style.border.width;
The style object also provides properties that map more directly to attributes, such as style.borderWidth or style.borderLeftWidth. There's a certain amount of duplication here, but you'll find the access offered is sometimes more refined.
Further info: HTML DOM Style Object...
LaxLoafer
Junior Poster in Training
68 posts since Aug 2011
Reputation Points: 43
Solved Threads: 12