Hi,
How do I get the size of a <div> in JavaScript, given :-
Note I am missing out the <html>/<body>/<script> sections here :)
~~~
<div id="canvas"
style="backgrou nd-color:#f0f0f0;p osition:relativ e;height:100%;w idth:100%;"
onresizeend="dr awAll();"></div>
~~~
var h = canvas.height;
drawChart(h);
~~~
function drawAll()
{
h = canvas.height;
drawChart( h)
}
~~~
If I do an alert() to print out 'h' it is coming out as 'undefined'.
I am probably doing something simple wrong.
Hope you can help,
Aaron
How do I get the size of a <div> in JavaScript, given :-
Note I am missing out the <html>/<body>/<script> sections here :)
~~~
<div id="canvas"
style="backgrou nd-color:#f0f0f0;p osition:relativ e;height:100%;w idth:100%;"
onresizeend="dr awAll();"></div>
~~~
var h = canvas.height;
drawChart(h);
~~~
function drawAll()
{
h = canvas.height;
drawChart( h)
}
~~~
If I do an alert() to print out 'h' it is coming out as 'undefined'.
I am probably doing something simple wrong.
Hope you can help,
Aaron
Comment