473,381 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,381 software developers and data experts.

Obtaining the actual size of the html document's body

Anyone know how to obtain the true size of the html document's body? The
control contains the size that the control was set to. The body object
appears to contain the same size. That information must be stored somewhere
in order for the scroll bars to be enabled when the body is larger than the
container.
Also, I have noticed that if I initialize the control with a large size, the
vertical scrollbar is disabled, but is still visible, while the horizontal
scrollbar is invisible. Is there any way to hide both?
Jul 21 '05 #1
2 5675
Sounds like your after a way to determine the height and width of a
displayed page, which you cant easily do that, but these might help work out
what you are looking for.

http://www.howtocreate.co.uk/tutoria...?tut=0&part=16

http://www.howtocreate.co.uk/perfectPopups.html

If you want no scrollbars, you could wrap your body content in a div and set
the css attribute position: absolute;

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"gregl" <gr***@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
Anyone know how to obtain the true size of the html document's body? The
control contains the size that the control was set to. The body object
appears to contain the same size. That information must be stored
somewhere
in order for the scroll bars to be enabled when the body is larger than
the
container.
Also, I have noticed that if I initialize the control with a large size,
the
vertical scrollbar is disabled, but is still visible, while the horizontal
scrollbar is invisible. Is there any way to hide both?

Jul 21 '05 #2
Thanks for the links. They gave me something further to investigate.
Unfortunately, it didn't help.
When I obtain the clientHeight and clientWidth via the IHTMLElement2
interface I receive 0. I tried against both the body and the document
elements, as shown below.
If I use the document element's scrollWidth and scrollHeight, the values are
close but I still have both scroll bars. Placing the body context within an
absolute positioned DIV did not remove the scrollbars.

If you have any further suggestions or a clue as to why the clientHeight and
clientWidth are 0, I'd appreciate it.

Thanks!

private void axWebBrowser1_DocumentComplete (Object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if ( ( (int)axWebBrowser1.get_ReadyState() >= 4) &
( ! axWebBrowser1.get_Busy() ))
{
HTMLDocumentClass doc = (HTMLDocumentClass)axWebBrowser1.get_Document();
IHTMLElement2 body = (IHTMLElement2)doc.get_body();
IHTMLElement2 docElem = (IHTMLElement2)doc.get_documentElement();
int width = docElem.get_clientWidth();
int height = docElem.get_clientHeight();
axWebBrowser1.set_Width(width);
axWebBrowser1.set_Height(height);
}
}

"John Timney (ASP.NET MVP)" wrote:
Sounds like your after a way to determine the height and width of a
displayed page, which you cant easily do that, but these might help work out
what you are looking for.

http://www.howtocreate.co.uk/tutoria...?tut=0&part=16

http://www.howtocreate.co.uk/perfectPopups.html

If you want no scrollbars, you could wrap your body content in a div and set
the css attribute position: absolute;

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"gregl" <gr***@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
Anyone know how to obtain the true size of the html document's body? The
control contains the size that the control was set to. The body object
appears to contain the same size. That information must be stored
somewhere
in order for the scroll bars to be enabled when the body is larger than
the
container.
Also, I have noticed that if I initialize the control with a large size,
the
vertical scrollbar is disabled, but is still visible, while the horizontal
scrollbar is invisible. Is there any way to hide both?


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Closer | last post by:
I am new to XML and XSL, could someone please help? I have my XML and XSL files and can view the XML file with the stylesheet in my browser. Everything is fine. What I want to do is to...
10
by: Rithish | last post by:
I want to emulate paging in an HTML document. something like, ------------------------- | | | <DIV> | | | | <TABLE></TABLE>...
4
by: Eduard Witteveen | last post by:
Hello, I want to make a hooverbox, which is shown when the mousepointer is not moved for a amount of time. When the hooverbox is shown, i will do a server request to retrieve the information...
3
by: Marek | last post by:
Hi What I need to do is to take the following XML (or some variant of it): <?xml version="1.0" encoding="UTF-8"?> <MyRawHTML> <H1>Hello, world!</H1> </MyRawHTML> And apply an XSLT to it along...
2
by: gregl | last post by:
Anyone know how to obtain the true size of the html document's body? The control contains the size that the control was set to. The body object appears to contain the same size. That information...
7
by: xformer | last post by:
Hello everybody, today I was working on a web site when I found a strange effect. Take the following html document: ----begin---- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...
3
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document...
3
Loftlore
by: Loftlore | last post by:
Confession. This is my first post here. Wish me luck please. I am trying to get a .jpg called from a javascript hiLite to popup rather than to load as a full page. The example can be found at...
11
Dormilich
by: Dormilich | last post by:
Lately I have seen so much awful HTML, that I like to show what a HTML document should look like, regarding the requirements from the W3C. the absolute minimum is defined as: or expressed in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.