Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How in JavaScript set the sizes of objects?

Status
Not open for further replies.

VJar

Programmer
Aug 3, 2002
18
UA
I need depending on some
Conditions to set the sizes of a layer and the table
For an explanation a question I shall guide a simple example:

< div id = &quot;Layer1&quot; style = &quot; position:absolute; width:200px; height:115px; z-index:1; left: 12px; top: 71px &quot; > </div>

< table border = &quot;1&quot; cellspacing = &quot;0&quot; cellpadding = &quot;0&quot; width = &quot;400&quot; height = &quot;40&quot; >
<tr>
< td width = &quot;150&quot; height = &quot;40&quot; > </td>
< td width = &quot;250&quot; height = &quot;40&quot; > </td>
</tr>
</table>

The sizes of layer Layer1 can I set in Java script:

layer1.style.width = 200
layer1.style.height = 300

Is it possible a similar way or another to set the sizes of the table
and each cell (<td>)?
To me simply does not approach to print the table with
&quot;document.write&quot;, to set the necessary sizes.
Help, if may
 
VJar,

give the <td> an id, and you should be able to the same way as a <div>.

<table border=&quot;1&quot;>
<tr>
<td id=&quot;td1&quot;>
<a href=&quot;#&quot; onclick=&quot;td1.style.width = '200px';return false;&quot;>foo</a>
</td>
<td id=&quot;td2&quot;>
<a href=&quot;#&quot; onclick=&quot;td2.style.width = '200px';return false;&quot;>bar</a>
</td>
</tr>
</table> =========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top