javascript - getComputedStyle or currentStyle for border-left-width -
my html : <div id="bar" ></div>
my css :
#bar { border-left-width:150px; }
my js :
function getstyle(el,styleprop) { if(el.currentstyle)var y=el.currentstyle[styleprop]; else if(window.getcomputedstyle)var y=document.defaultview.getcomputedstyle(el,null).getpropertyvalue(styleprop); return y; } alert(getstyle(document.getelementbyid("bar"),"border-left-width"));//outputs 0px
the fiddle : http://jsfiddle.net/4abhz/1
how can border-left-width
property? (with exemple it's not working (on firefox))
check border-left-style
property. it's set none
(the default). set solid
, you're go: http://jsfiddle.net/paulpro/4abhz/4/
Comments
Post a Comment