Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 8th, 2004, 04:28 PM
Authorized User
 
Join Date: Nov 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old December 8th, 2004, 08:28 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript with <div> aware Javascript How-To 3 August 25th, 2005 05:57 AM
hide the <div> crmpicco Javascript How-To 1 August 22nd, 2005 09:43 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
scrolling <DIV> anshul Javascript How-To 12 August 4th, 2004 09:51 AM
<A><DIV><TABLE></DIV></A> anshul HTML Code Clinic 2 July 17th, 2004 02:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.