tags:

views:

256

answers:

3

Hi!

Two questions ... I want to use the object tag to embed an html file that uses external style sheets ... however, nothing that I have tried works. The first question is how to that? ... note: the style sheets are linked to both documents.

The second question is how to determine and set the height attribute of the object so as to eliminate scrollbars ...

The object tag is inside the folllowing DIV ...

In IE8, I simply call "ScrollHeightValue('SF_010A','SF_010B')" ... which are the ids of the object tag and the body of the document being embedded.

function ScrollHeightValue(a, b) {
    var testObject1 = document.getElementById(a);
    var testObject = testObject1.getElementById(b);
    testObject1.style.height = testObject.scrollHeight + 'px';
}

Thus, the second question really is ... how do I do this for non-IE browsers?

I'm a novice ... maybe I'm not asking the questions correctly ... just want to know hoe to detetmine the height of the object so that the content of the object is visible ... without the scrollbars.

Thanks,

Bob

A: 

Try https://developer.mozilla.org/en/DOM/window.getComputedStyle

TML
A: 

If you want to embed a HTML document in another, you must use an iframe, not an object.

Aaron Digulla
A: 

Answer to question number one: To embed external HTML files in your page, use iframes, not "object".

Answer to question number two: To get the total height of a DOM element, use its scrollHeight property. However, this property has been reported to be off by 5px for IE 8.

Here Be Wolves
Apologies ... Was gone yesterday ... thanks for the input.How does using iFrames rather than the object tag help me with regard to determining the scrollHeight of the embedded object, except in IE ... or using external style sheets with it?I get the same results in either case.The scrollHeight does appear to be off by 5px in IE8 but I can work around that ... question is how to get it for FF and other browsers?Thanks!
For one, iframes are meant to handle external HTML pages (complete with css and javascript). So using iframes instead of <object> is semantically correct.Secondly, iframes place many restrictions on the pages loaded inside them that are essential for cross-domain security. I can't say the same about <object>.Firefox does support scrollHeight and scrollWidth.And as for other browsers, I only say this: if IE supports scrollHeight, there probably isn't a browser that doesn't.chers, jrh.
Here Be Wolves