hello,
i am sending whole javascript code(it is for freezing html header)
it works fine eith IE but not firefox scroll bar does not come - var divContent = null;
-
var divHeaderRow = null;
-
var divHeaderColumn = null;
-
var divHeaderRowColumn = null;
-
var headerRowFirstColumn = null;
-
var x;
-
var y;
-
var horizontal = false;
-
var vertical = false;
-
var browsername = null;
-
// Copy table to top and to left
-
function CreateScrollHeader(content, scrollHorizontal, scrollVertical)
-
{
-
browsername = navigator.appName;
-
horizontal = scrollHorizontal;
-
vertical = scrollVertical;
-
-
if (content != null)
-
{
-
divContent = content;
-
if (browsername == 'Netscape')
-
{
-
var headerRow = divContent.childNodes[1].childNodes[1].childNodes[1];
-
var headersecondrow =divContent.childNodes[1].childNodes[1].childNodes[2];
-
x = divContent.childNodes[1].offsetWidth;
-
y = divContent.childNodes[1].offsetHeight;
-
}
-
else
-
{
-
var headerRow = divContent.childNodes[0].childNodes[0].childNodes[0];
-
var headersecondrow =divContent.childNodes[0].childNodes[0].childNodes[1];
-
x = divContent.childNodes[0].offsetWidth;
-
y = divContent.childNodes[0].offsetHeight;
-
}
-
divHeaderRow = divContent.cloneNode(true);
-
if (horizontal)
-
{
-
divHeaderRow.style.height = headerRow.offsetHeight + headersecondrow.offsetHeight;
-
divHeaderRow.style.overflow = "hidden";
-
-
divContent.parentNode.insertBefore(divHeaderRow, divContent);
-
if (browsername == 'Netscape')
-
{
-
divContent.childNodes[1].style.position = "absolute";
-
divContent.childNodes[1].style.top = "-" + (headerRow.offsetHeight + headersecondrow.offsetHeight) ;
-
-
}
-
else
-
{
-
divContent.childNodes[0].style.position = "absolute";
-
divContent.childNodes[0].style.top = "-" + (headerRow.offsetHeight + headersecondrow.offsetHeight) ;
-
}
-
y = y - headerRow.offsetHeight;
-
}
-
-
divHeaderRowColumn = divHeaderRow.cloneNode(true);
-
if (browsername == 'Netscape')
-
{
-
headerRowFirstColumn = headerRow.childNodes[1];
-
}
-
else
-
{
-
headerRowFirstColumn = headerRow.childNodes[0];
-
}
-
divHeaderColumn = divContent.cloneNode(true);
-
divContent.style.position = "relative";
-
-
if (vertical)
-
{
-
divContent.parentNode.insertBefore(divHeaderColumn, divContent);
-
divContent.style.left = headerRowFirstColumn.offsetWidth;
-
if (browsername == 'Netscape')
-
{
-
divContent.childNodes[1].style.position = "absolute";
-
divContent.childNodes[1].style.left = "-" + headerRowFirstColumn.offsetWidth;
-
}
-
else
-
{
-
divContent.childNodes[0].style.position = "absolute";
-
divContent.childNodes[0].style.left = "-" + headerRowFirstColumn.offsetWidth;
-
}
-
}
-
else
-
{
-
divContent.style.left = 0;
-
}
-
-
if (vertical)
-
{
-
divHeaderColumn.style.width = headerRowFirstColumn.offsetWidth;
-
divHeaderColumn.style.overflow = "hidden";
-
divHeaderColumn.style.zIndex = "99";
-
-
divHeaderColumn.style.position = "absolute";
-
divHeaderColumn.style.left = "0";
-
addScrollSynchronization(divHeaderColumn, divContent, "vertical");
-
x = x - headerRowFirstColumn.offsetWidth;
-
}
-
-
if (horizontal)
-
{
-
if (vertical)
-
{
-
divContent.parentNode.insertBefore(divHeaderRowColumn, divContent);
-
}
-
divHeaderRowColumn.style.position = "absolute";
-
divHeaderRowColumn.style.left = "0";
-
divHeaderRowColumn.style.top = "0";
-
divHeaderRowColumn.style.width = headerRowFirstColumn.offsetWidth;
-
divHeaderRowColumn.overflow = "hidden";
-
divHeaderRowColumn.style.zIndex = "100";
-
divHeaderRowColumn.style.backgroundColor = "#ffffff";
-
-
}
-
-
if (horizontal)
-
{
-
addScrollSynchronization(divHeaderRow, divContent, "horizontal");
-
}
-
-
if (horizontal || vertical)
-
{
-
window.onresize = ResizeScrollArea;
-
ResizeScrollArea();
-
}
-
}
-
}
-
-
-
// Resize scroll area to window size.
-
function ResizeScrollArea()
-
{
-
var height = document.documentElement.clientHeight - 120;
-
if (!vertical)
-
{
-
height -= divHeaderRow.offsetHeight;
-
}
-
var width = document.documentElement.clientWidth - 50;
-
if (!horizontal)
-
{
-
width -= divHeaderColumn.offsetWidth;
-
}
-
var headerRowsWidth = 0;
-
if(browsername == 'Netscape')
-
{
-
divContent.childNodes[1].style.width = x;
-
divContent.childNodes[1].style.height = y;
-
}
-
else
-
{
-
divContent.childNodes[0].style.width = x;
-
divContent.childNodes[0].style.height = y;
-
}
-
if (divHeaderRowColumn != null)
-
{
-
headerRowsWidth = divHeaderRowColumn.offsetWidth;
-
}
-
-
// width
-
if(browsername == 'Netscape')
-
{
-
if (divContent.childNodes[1].offsetWidth > width)
-
{
-
divContent.style.width = Math.max(width - headerRowsWidth, 0);
-
divContent.style.overflowX = "scroll";
-
divContent.style.overflowY = "auto";
-
}
-
else
-
{
-
divContent.style.width = x;
-
divContent.style.overflowX = "auto";
-
divContent.style.overflowY = "auto";
-
}
-
}
-
else
-
{
-
if (divContent.childNodes[0].offsetWidth > width)
-
{
-
divContent.style.width = Math.max(width - headerRowsWidth, 0);
-
divContent.style.overflowX = "scroll";
-
divContent.style.overflowY = "auto";
-
}
-
else
-
{
-
divContent.style.width = x;
-
divContent.style.overflowX = "auto";
-
divContent.style.overflowY = "auto";
-
}
-
}
-
if (divHeaderRow != null)
-
{
-
divHeaderRow.style.width = divContent.offsetWidth + headerRowsWidth;
-
}
-
-
// height
-
if(browsername == 'Netscape')
-
{
-
if (divContent.childNodes[1].offsetHeight > height)
-
{
-
divContent.style.height = Math.max(height, 80);
-
divContent.style.overflowY = "scroll";
-
}
-
else
-
{
-
divContent.style.height = y;
-
divContent.style.overflowY = "hidden";
-
}
-
}
-
else
-
{
-
if (divContent.childNodes[0].offsetHeight > height)
-
{
-
divContent.style.height = Math.max(height, 80);
-
divContent.style.overflowY = "scroll";
-
}
-
else
-
{
-
divContent.style.height = y;
-
divContent.style.overflowY = "hidden";
-
}
-
}
-
if (divHeaderColumn != null)
-
{
-
divHeaderColumn.style.height = divContent.offsetHeight;
-
}
-
-
// check scrollbars
-
if (divContent.style.overflowY == "scroll")
-
{
-
divContent.style.width = divContent.offsetWidth + 17;
-
}
-
if (divContent.style.overflowX == "scroll")
-
{
-
divContent.style.height = divContent.offsetHeight + 17;
-
}
-
if(browsername == 'Netscape')
-
{
-
divContent.parentNode.style.width = divContent.offsetWidth + headerRowsWidth;
-
}
-
else
-
{
-
divContent.parentElement.style.width = divContent.offsetWidth + headerRowsWidth;
-
}
-
-
}
-
-
********************************************************************************
-
// Synchronize div elements when scrolling
-
// from http://webfx.eae.net/dhtml/syncscroll/syncscroll.html
-
// ********************************************************************************
-
// This is a function that returns a function that is used
-
// in the event listener
-
function getOnScrollFunction(oElement) {
-
return function () {
-
if (oElement._scrollSyncDirection == "horizontal" || oElement._scrollSyncDirection == "both")
-
oElement.scrollLeft = event.srcElement.scrollLeft;
-
if (oElement._scrollSyncDirection == "vertical" || oElement._scrollSyncDirection == "both")
-
oElement.scrollTop = event.srcElement.scrollTop;
-
};
-
-
}
-
-
// This function adds scroll syncronization for the fromElement to the toElement
-
// this means that the fromElement will be updated when the toElement is scrolled
-
function addScrollSynchronization(fromElement, toElement, direction) {
-
removeScrollSynchronization(fromElement);
-
-
fromElement._syncScroll = getOnScrollFunction(fromElement);
-
fromElement._scrollSyncDirection = direction;
-
fromElement._syncTo = toElement;
-
if(browsername != 'Netscape')
-
{
-
toElement.attachEvent("onscroll", fromElement._syncScroll);
-
}
-
else
-
{
-
toElement.addEventListener("scroll", fromElement._syncScroll,true);
-
}
-
}
-
-
// removes the scroll synchronization for an element
-
function removeScrollSynchronization(fromElement) {
-
if (fromElement._syncTo != null)
-
if(browsername != 'Netscape')
-
{
-
fromElement._syncTo.detachEvent("onscroll", fromElement._syncScroll);
-
}
-
else
-
{
-
fromElement._syncTo.removeEventListener("scroll", fromElement._syncScroll,true);
-
}
-
-
fromElement._syncTo = null;
-
fromElement._syncScroll = null;
-
fromElement._scrollSyncDirection = null;
-
}
-
Thanks
3 2725 gits 5,390
Recognized Expert Moderator Expert
hi ...
please use the code tags when posting code ... this is the last friendly note about that ... it helps the users to better read your code and it is a posting rule ... that all members has to follow ... read: How to Ask a Question
kind regards
Look, I told to see that solution.
I think you didn't see it.
Anyway, it will be. -
style.width="50px"; //Not = 50 or -50 or something like that.
-
//this is valid.
-
Now try it and see what happens.
Good luck.
Kind regards,
Dmjpro.
acoder 16,027
Recognized Expert Moderator MVP
Don't use browser detection. You're checking for "Netscape" and basing your code on that. Use object detection instead, e.g. - if (obj.addEventListener) {
See this link.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David. E. Goble |
last post by:
Hi all; I have the following files; index.html, sigsheader.js,
sigsboby.js, smilesbody.js and smiles.js. The sourse is below.
The page displays two manual slide shows... Each slideshow has a set
of buttons. the top slideshow (the smiles work fine. How ever the sigs
slideshow displays the pictures in the smiles section.
*************** index.html *****************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...
|
by: David. E. Goble |
last post by:
Arrrh! some buttons work while others don't, but I can't see why. I
have tried comparing the files that do work, with the ones that don't.
But to no help.
The funny thing is the parts that work have the same code, except
different variables.
(Note Javascript and htm code was writen by a c program, the code then
run thru a html to js converter)
|
by: Matt |
last post by:
I have a web page that reads a dataset, populates a datagrid, and then
launches Excel to display the results. I was able to format the results
(font, background color ..) and even create a filter for the top header
row, but I want to also freeze the panes. Does anyone know of a way to
program the WorksheetOptions information?
Below is a sample of what I would like the result to be. I got this
result by freezing the panes in Excel and...
|
by: tshad |
last post by:
Many (if not most) have said that code-behind is best if working in teams -
which does seem logical.
How do you deal with the flow of the work?
I have someone who is good at designing, but know nothing about ASP. He can
build the design of the pages in HTML with tables, labels, textboxes etc.
But then I would need to change them to ASP.net objects and write the code
to make the page work (normally I do this as I go - can't do this...
|
by: Steven K |
last post by:
Hello,
I am having a problem where my computer is freezing when I run a ASP.net
project. It freezes in the debugger, or if I try to run it as localhost. I
cannot even access the windows Taskbar, or anything. I have to power off my
computer.
It is a brand new machine, XP Pro, VS.NET 2003.
Other Notes:
| |
by: MaRCeLO PeReiRA |
last post by:
Hi All,
After PostgreSQL freeze some times, I am moving from
7.3.4 to 7.4.1, trying to solve this problem.
When the daemon get frozen, I can't even use psql to
browse a database (as if the database was down for
some reason, or the daemon is not running).
In these cases, a "pg_ctl -D /var/db stop" followed by
|
by: Job Lot |
last post by:
Is there any way of freezing columns in Windows Forms Data Grid control?
Thanks
|
by: bearophileHUGS |
last post by:
Most of my ideas seem usless or stupid, but I think expressing them
here doesn't harm much.
This is an idea for Py 3.0, because it's not backward compatible.
Dicts and sets require immutable keys, like tuples or frozensets, but
to me they look like a duplication. So the idea is to remove tuples and
frozensets (and replace the few other uses of tuples with lists, like
the % interpolation), and to add a freeze operation, to freeze lists,...
|
by: asearle |
last post by:
Hi everyone,
I currently display XML data with XSLT which works fine (including some dynamic filtering with JavaScript).
However, often the data which is returned is quite lengthy and, as the user scrolls down to look at the data, the header disappears off the top of the viewable portion of the browser. This is quite irritating as the header contains summing and title information which should remain in view.
So my question here is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |