javascript - getting the size of a content box with javascriptHey -
this question has answer here:
i trying width of content box following comand:
var box = document.getelementbyid('player'); var boxsize = box.clientwidth;
it seems return something. when alert it gives out number. still throws error:
uncaught typeerror: cannot read property 'clientwidth' of null
what happening here?
var box = document.getelementbyid('player'); if(box){ var boxsize = box.offsetwidth; }
Comments
Post a Comment