Click here to Skip to main content
15,887,302 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello -
I have one javascript issue and I hope someone can help me. I need to add javascript code to the code below so that the table table1 (red table) takes whole area of the cell cell1. Also Table table1 should resize itself to take all space of cell1 when we resize browser window.
Here is the html code:

XML
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <title></title>
        <style type="text/css">
        html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        }
        </style>
  </head>
  <body>
  <table height=100% width=100% border=1 cellpadding=0 cellspacing=0>
    <tr><td colspan=2 height=40px></td></tr>
    <tr><td width=75% id="cell1">
        <table style="height:auto" width=100% bgcolor=red id="table1"><tr><td></td></tr></table>
        </td>
        <td></td>
     </tr>
  </table>
  </body>
</html>



Thanks in advance
Posted
Comments
Anele Ngqandu 20-Dec-11 16:23pm    
Hi, do you like realy need to use java script??
laziale 20-Dec-11 16:27pm    
yes
Sergey Alexandrovich Kryukov 20-Dec-11 18:22pm    
Is there another method not using server-side programming?
As this is just the change of view, JavaScript is quite adequate.
--SA
Sergey Alexandrovich Kryukov 20-Dec-11 18:27pm    
Even though manipulations like that are pretty easy, the behavior does not seem to make sense. If cell1 is a part of table, what does it mean: "table1 (red table) takes whole area of the cell cell1"? It is already bigger than the cell. If this is just awkward formulation, use "Improve question" above.
--SA
Sunasara Imdadhusen 21-Dec-11 2:35am    
You need to re-size Horizontally or Vertically 100%?

1 solution

Instead of putting style="height:auto" can we try having height attribute for Table table1 to 100%.

XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<table height=100% width=100% border=1 cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=40px></td></tr>
<tr><td width=75% id="cell1">
<table height=100% width=100% bgcolor=red id="table1"><tr><td></td></tr></table>
</td>
<td></td>
</tr>
</table>
</body>
</html>




Hope this helps !!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900