Add css via javascript -
hy, maybe stupid question , tottaly easy, can't make work please help. here's code.
asp=height / width * 100; document.getelementbyid("head_wrap").style["padding-top"] = "'+asp+%'";
using alert(asp); gives correct value, made mistake here "'+asp+%'", want value in percentages said doesn't work. help!
you have syntax errors in set value double quotes , single quotes. use property style
object, sample:
asp = height / width * 100; document.getelementbyid("head_wrap").style.paddingtop = asp + "%";
alternativally, use did, adjusts in code.
asp = height / width * 100; document.getelementbyid("head_wrap").style["padding-top"] = asp + "%;
i modified jsfiddle
, take look here.
Comments
Post a Comment