Javascript variable as a width/height
Posted: Sat Mar 08, 2008 4:10 pm
Firstly, I have no idea what this would be called so I stood no chance of finding this out on google so I'm sorry if this is obvious or has been asked before.
I'm pretty new to javascript and I don't really fancy learning it in its entirety, but small snippets help me greatly. I understand variables and writing them and can implement ajax, but one thing that I really would like to do is evading me. I would like to use a javascript variable as a height or width of a cell/row/table. I know you can set the style width of a cell or row with javascript, but is there any way whatsoever to use:
???
(Obviously with myvar already defined)
I understand if you tell me to forget about it and just define it in the cell's style using javascript, but this is so much easier on a large scale if I could do this. Do I just need to use some special syntax or is it just not possible?
Thanks
I'm pretty new to javascript and I don't really fancy learning it in its entirety, but small snippets help me greatly. I understand variables and writing them and can implement ajax, but one thing that I really would like to do is evading me. I would like to use a javascript variable as a height or width of a cell/row/table. I know you can set the style width of a cell or row with javascript, but is there any way whatsoever to use:
Code: Select all
<table><tr><td width=myvar>Cell</td></tr></table>(Obviously with myvar already defined)
I understand if you tell me to forget about it and just define it in the cell's style using javascript, but this is so much easier on a large scale if I could do this. Do I just need to use some special syntax or is it just not possible?
Thanks