Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make HTML table that can be resized to the visible window with button (javascript)?
    primarykey
    data
    text
    <p>I have a table (decided to throw everything from my previous question out and have it draw a plain old table) that needs to be able to be re-sized on the page at the click of a button that calls a javascript function.</p> <p>The table could be small or it could be huge - far bigger than the page. </p> <p>I need to have a button that will re-size the table to the <strong>size of the visible window</strong> when clicked. And another button that will put the size of the table back to as big as it was.</p> <p>This is how the table is made:</p> <pre><code>&lt;table id=resizableTable cellpadding='5' cellspacing='0' border='0' width: '75%' leftmargin='50' &gt; </code></pre> <p>How I get the visible window area:</p> <pre><code>var visHeight = window.innerHeight; var visWidth = window.innerWidth; </code></pre> <p>I tried the following in javascript :</p> <p>1)</p> <pre><code>document.getElementById('resizableTable').max-width = visWidth + 'px'; document.getElementById('resizableTable').max-height = visHeight + 'px'; </code></pre> <p>2)</p> <pre><code>document.getElementById('resizableTable').style.width = visWidth + 'px'; document.getElementById('resizableTable').style.height = visHeight + 'px'; </code></pre> <p>3)</p> <pre><code>jQuery('#resizableTable').css('width',visWidth + 'px'); jQuery('#resizableTable').css('height',visHeight + 'px'); </code></pre> <p>But none of these work -- in fact, the table doesn't change in size at all! What am I doing wrong? I haven't even been able to work on the resizing the table back to the original size yet because I've gotten stuck on this part.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload