Discussion:
Disable Ctrl+F in IE
(too old to reply)
Katrina
2009-08-11 21:15:27 UTC
Permalink
I am working on a page that has a table with the header row and column
frozen. It is very close to this:
http://www.codeproject.com/KB/scripting/HTMLFixedHeaders.aspx?fid=318828&df=90&mpp=25&sort=Position&select=1616601&tid=1616601

The only problem I have now is that Ctrl+F does not work right. Is
there are way to disable Ctrl+F just on this page? Or is there a work-
around for the Javascript? I think this is the function that is
messing up my page.

function CreateScrollHeader(content, scrollHorizontal, scrollVertical)
{
horizontal = scrollHorizontal;
vertical = scrollVertical;

if (content != null)
{
divContent = content;
var headerRow = divContent.childNodes[0].childNodes[0].childNodes
[0];
x = divContent.childNodes[0].offsetWidth;
y = divContent.childNodes[0].offsetHeight;

divHeaderRow = divContent.cloneNode(true);
if (horizontal)
{
divHeaderRow.style.height = headerRow.offsetHeight;
divHeaderRow.style.overflow = "hidden";

divContent.parentNode.insertBefore(divHeaderRow, divContent);
divContent.childNodes[0].style.position = "absolute";
divContent.childNodes[0].style.top = "-" + headerRow.offsetHeight;

y = y - headerRow.offsetHeight;
}

divHeaderRowColumn = divHeaderRow.cloneNode(true);
headerRowFirstColumn = headerRow.childNodes[0];
divHeaderColumn = divContent.cloneNode(true);
divContent.style.position = "relative";

if (vertical)
{
divContent.parentNode.insertBefore(divHeaderColumn, divContent);
divContent.style.left = headerRowFirstColumn.offsetWidth;

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();
}
}
}
Vincenzo Di Russo [MVP]
2009-08-12 04:39:18 UTC
Permalink
Post by Katrina
I am working on a page that has a table with the header row and column
http://www.codeproject.com/KB/scripting/HTMLFixedHeaders.aspx?fid=318828&df=90&mpp=25&sort=Position&select=1616601&tid=1616601
The only problem I have now is that Ctrl+F does not work right. Is
there are way to disable Ctrl+F just on this page? Or is there a work-
around for the Javascript? I think this is the function that is
messing up my page.
function CreateScrollHeader(content, scrollHorizontal, scrollVertical)
{
horizontal = scrollHorizontal;
vertical = scrollVertical;
if (content != null)
{
divContent = content;
var headerRow = divContent.childNodes[0].childNodes[0].childNodes
[0];
x = divContent.childNodes[0].offsetWidth;
y = divContent.childNodes[0].offsetHeight;
divHeaderRow = divContent.cloneNode(true);
if (horizontal)
{
divHeaderRow.style.height = headerRow.offsetHeight;
divHeaderRow.style.overflow = "hidden";
divContent.parentNode.insertBefore(divHeaderRow, divContent);
divContent.childNodes[0].style.position = "absolute";
divContent.childNodes[0].style.top = "-" + headerRow.offsetHeight;
y = y - headerRow.offsetHeight;
}
divHeaderRowColumn = divHeaderRow.cloneNode(true);
headerRowFirstColumn = headerRow.childNodes[0];
divHeaderColumn = divContent.cloneNode(true);
divContent.style.position = "relative";
if (vertical)
{
divContent.parentNode.insertBefore(divHeaderColumn, divContent);
divContent.style.left = headerRowFirstColumn.offsetWidth;
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();
}
}
}
Ask for help in the MSDN IE Development Forums instead:
http://social.msdn.microsoft.com/forums/en-US/category/iedevelopment/
--
Vincenzo Di Russo
Microsoft® MVP - Most Valuable Professional since 2003
Windows Internet Explorer, Windows Desktop Experience & Security
My MVP Profile: https://mvp.support.microsoft.com/profile/Vincenzo
My Blog: http://blogs.dotnethell.it/vincent/
Loading...