<script type="text/javascript">
$(document).ready(function (e) {
var iframe = document.getElementById("OfficeMain");
if (iframe.attachEvent) {
//todo something
SetIframeSrcStyle();
SetCwinHeight();
}
else {
iframe.onload = function () {
//todo something
SetIframeSrcStyle();
SetCwinHeight();
}
}
});
function SetIframeSrcStyle() {
var src = document.getElementById("OfficeMain");
var doc = (src.contentWindow || src.contentDocument);
if (doc.document) {
doc.document.body.style.backgroundColor = "#555";
}
}
function SetCwinHeight() {
var iframeid = document.getElementById("OfficeMain"); //iframe id
if (document.getElementById) {
if (iframeid && !window.opera) {
if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight) {
iframeid.height = iframeid.contentDocument.body.offsetHeight;
} else if (iframeid.Document && iframeid.Document.body.scrollHeight) {
iframeid.height = iframeid.Document.body.scrollHeight;
}
}
}
}