Determining the height of an embedded html object

Two questions ... I want to use an object tag to embed an html file that uses external stylesheets ... however nothing I've tried works. First question: how is that? ... note: stylesheets are linked to both documents.

The second question is how to define and set the object's height attribute to exclude scrollbars ...

The object tag is inside the following DIVs ...

 

In IE8, I just call "ScrollHeightValue (" SF_010A "," SF_010B ")" ... which are the object tag IDs and the body of the inline document.

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

      

So the second question is really ... how to do this for non-IE browsers?

I'm a newbie ... maybe I'm not asking the questions correctly ... just want to know the hoe to clip the height of the object so that the contents of the object can be seen ... no scrollbars.

Thanks,

Bean

0


a source to share


3 answers


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 overall height of a DOM element, use the scrollHeight property. However, this property is reportedly disabled by 5px for IE 8.

+1


a source


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



0


a source


If you want to embed an HTML document in another, you must use iframe

, not object

.

0


a source







All Articles