I have the following code in html:
<canvas id="myCanvas" width =800 height=800>
I want, instead of specifying the width
as 800
, to call the JavaScript function getWidth()
to get the width e.g.
<canvas id="myCanvas" width =getWidth() height=800>
What is the correct syntax to do it? Because what I'm doing doesn't work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…