p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   sizeable <div> (http://p2p.wrox.com/showthread.php?t=22314)

johnjohn December 8th, 2004 04:28 PM

sizeable <div>
 
Hi everybody,

I'm doing a webpage where I have to put a huge amount of data in a table.I want to always keep showing the top menu. So what I do is a "little scrollable windows" for the data. The problem is that I want the page to don't have a scrollbar but expand as much as I can my data windows with its own scrollbar.

So here is my code to make my scrollable windows for my data



<style type="text/css">
    <!--
    div.scroll
    {
        height: 600px;
        width: 100%;
        overflow: auto;
        border: 1px solid #666;
        background-color: #ccc;
        padding: 1px;
    }
    -->
</style>


But the problem is that I can't choose a percentage for the height so is there a way to retrieve the windows size and adjust the data windows from there??


Thank you very much


vinod_yadav1919 December 8th, 2004 08:28 PM

Hiii johnjohn,
yes you can get the window size
*** for IE*****
//document.body.clientWidth;
//document.body.clientHeight;
*** for NS*****

//innerWidth;
//innerHeight;


<script>
function AdjustScreen()
{
obj=document.getElementById("divid")
obj.style.width=document.body.clientWidth-100
//alert(document.body.clientWidth);
//if you want you can also manipulate obj.style.height
}
window.onresize = AdjustScreen
</script>
<div id="divid" style="overflow: auto; width: 168px; height: 420px;">
<table border=1 width=100%>
<tr><td>Name</td><td>Name1</td><td>Name2</td><td>Name3</td><td>Name4</td></tr>
<tr><td>Name1</td><td>Name11</td><td>Name21</td><td>Name13</td><td>Name14</td></tr>
</table></div>

Well i haven't tested for NS
Hope this will help you

Cheers :)

vinod


All times are GMT -4. The time now is 01:00 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.