DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > Crossbrowser DHTML
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 18.07.2006, 12:28
patelbrijeshn patelbrijeshn is offline
Neuer Benutzer
 
Join Date: 18.07.2006
Location: India
Posts: 3
Default

Hi ,
I want to display a huge table. So I want to make the table header
visible on the screen even as the user scrolls the window. I am using
div tag to create the floating table header.
Here is the code snippet :

HTML :

<body >
<div id="headStart" style="position: absolute;">
</div>
<table CELLSPACING="1" BORDER="0" HEIGHT="650" width="2918"
id="partTable" >

<tr id="head1">
............ table row to float
</tr>
</table>
</body>

For floating the table header I m using following javascript snippet :

var headTop = -1;
var FloatHead1;

function processScroll()
{
if (headTop < 0)
{
saveHeadPos();
}
if (headTop > 0)
{
if (document.documentElement && document.documentElement.scrollTop)
theTop = document.documentElement.scrollTop;
else if (document.body)
theTop = document.body.scrollTop;

if (theTop > headTop)
FloatHead1.style.top = (theTop-headTop) + 'px';
else
FloatHead1.style.top = '0px';
}
}

function saveHeadPos()
{
parTable = document.getElementById("headStart");
if (parTable != null)
{
headTop = parTable.offsetTop + 3;
FloatHead1 = document.getElementById("head1");
FloatHead1.style.position = "relative";
}
}

/* add event handlers here */
window.onscroll = processScroll;



It works great in I.E. , but the header does not float in Mozilla. The
processScroll() action does get called in Mozilla.

Please If any body can help me out fixing this. : )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT +2. The time now is 04:38.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.