Javascript function to get CSS properties in stylesheet file

CSS properties and Javascript Syntax

CSS
Javascrpt
CSS
Javascrpt
CSS
Javascrpt
background
background
cursor
cursor
text-decoration
textDecoration
background-attachment
backgroundAttachment
display
display
text-decoration: blink
textDecorationBlink
background-color
backgroundColor
filter
filter
text-decoration: line-through
textDecorationLineThrough
background-image
backgroundImage
font
font
text-decoration: none
textDecorationNone
background-position
backgroundPosition
font-family
fontFamily
text-decoration: overline
textDecorationOverline
background-repeat
backgroundRepeat
font-size
fontSize
text-decoration: underline
textDecorationUnderline
border
border
font-variant
fontVariant
text-indent
textIndent
border-bottom
borderBottom
font-weight
fontWeight
text-transform
textTransform
border-bottom-color
borderBottomColor
height
height
top
top
border-bottom-style
borderBottomStyle
left
left
vertical-align
verticalAlign
border-bottom-width
borderBottomWidth
letter-spacing
letterSpacing
visibility
visibility
border-color
borderColor
line-height
lineHeight
width
width
border-left
borderLeft
list-style
listStyle
z-index
zIndex
border-left-color
borderLeftColor
list-style-image
listStyleImage
border-top-width
borderTopWidth
border-left-style
borderLeftStyle
list-style-position
listStylePosition
border-width
borderWidth
border-left-width
borderLeftWidth
list-style-type
listStyleType
clear
clear
border-right
borderRight
margin
margin
clip
clip
border-right-color
borderRightColor
margin-bottom
marginBottom
color
color
border-right-style
borderRightStyle
margin-left
marginLeft
padding-left
paddingLeft
border-right-width
borderRightWidth
margin-right
marginRight
padding-right
paddingRight
border-style
borderStyle
margin-top
marginTop
padding-top
paddingTop
border-top
borderTop
overflow
overflow
page-break-after
pageBreakAfter
border-top-color
borderTopColor
padding
padding
page-break-before
pageBreakBefore
border-top-style
borderTopStyle
padding-bottom
paddingBottom
text-align
textAlign

backgroundImage

function getBkImage(obj) {
var img =(obj.currentStyle) ?  obj.currentStyle.backgroundImage : getComputedStyle(obj,'').getPropertyValue('background-image');
return img;
}

visibility

function getVisibility(obj) {
var str =(obj.currentStyle) ?  obj.currentStyle.visibility : getComputedStyle(obj,'').getPropertyValue('visibility');
return str;
}

background-color

function getbkColor(obj) {
var str =(obj.currentStyle) ?  obj.currentStyle.backgroundColor : getComputedStyle(obj,'').getPropertyValue('background-color');
return str;
}

width

function getbkColor(obj) {
var str =(obj.currentStyle) ?  obj.currentStyle.width : getComputedStyle(obj,'').getPropertyValue('width');
return str;
}

z-index

function getbkColor(obj) {
var str =(obj.currentStyle) ?  obj.currentStyle.zIndex : getComputedStyle(obj,'').getPropertyValue('z-index');
return str;
}

getstyle

function getstyle(elem, prop) {
	if(document.defaultView) {
		return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);
	}
	else if(elem.currentStyle) {
		var prop = prop.replace(/-(\w)/gi, function($0,$1) {
			return $1.toUpperCase();
		});
		return elem.currentStyle[prop];
	}
	else return null;
}