<script language="javascript" type="text/javascript">
function ResizeHeight(elementName) {
//find the height of the internal page
var the_height = 0;
var the_width = 0;
var ele = document.getElementById(elementName);
if (ele.contentWindow && ele.contentWindow.document.body) {
// IE
the_height = ele.contentWindow.document.body.scrollHeight;
the_width = ele.contentWindow.document.body.scrollWidth;
// firefox case
if (ele.contentWindow.document.documentElement) {
// fetch the correct height using documentElement in firefox
if (the_height < ele.contentWindow.document.documentElement.scrollHeight) {
the_height = ele.contentWindow.document.documentElement.scrollHeight;
}
}
}
else if (ele.contentDocument && ele.contentDocument.documentElement) {
// chrome, safari, opera
the_height = ele.contentDocument.documentElement.scrollHeight;
the_width = ele.contentDocument.documentElement.scrollWidth;
}
else {
// unused
the_height = ele.contentWindow.document.documentElement.scrollHeight;
the_width = ele.contentWindow.document.documentElement.scrollWidth;
}
//change the height of the iframe
if (the_height > 0 && the_width > 0) {
var diff = 0;
if (ele.height < the_height) {
ele.height = the_height + 50;
}
else {
// reduce un-necessary space created after navigating between the pages
diff = ele.height - the_height;
if (diff > 50 && the_height > 50/* value is greater than minimum height */) {
ele.height = the_height + 50;
}
}
if (ele.width < the_width) {
ele.width = the_width + 50;
}
else {
// reduce un-necessary space created after navigating between the pages
diff = ele.width - the_width;
if (diff > 100 && the_width > 50 /*value is greater than minimum width*/) {
ele.width = the_width + 50;
}
}
}
// validate and set height after every half a second
setTimeout(function () { ResizeHeight('" + getwpName() + "') }, 500);
}
// 웹파트명을 구합니다.
function getwpName() {
var wpname = "";
var a = MSO_ContentTable.getElementsByTagName("table");
MSO_ContentTable.setAttribute("height","100%");
for(i=0;i<a.length;i++)
{
a[i].setAttribute("height","100%");
}
var z = document.getElementsByTagName("div");
for(i=0;i<z.length;i++)
{
if(z[i].id.indexOf("WebPartWPQ",0) >=0 )
{
if(z[i].hasChildNodes())
{
if(z[i].firstChild.nodeName.toUpperCase() == "IFRAME")
{
wpname = z[i].firstChild.name;
//z[i].firstChild.setAttribute("height","100%");
}
}
}
}
return wpname;
}
// 페이지가 로드 되면 실행
// on page load, resize iframe, depending on user browser, call resize routine onload
if (window.attachEvent) {
window.attachEvent("onload", function () {
window.setTimeout("ResizeHeight('" + getwpName() + "')", 500);
});
}
else if (window.addEventListener) {
window.addEventListener("load", function () {
window.setTimeout("ResizeHeight('" + getwpName() + "')", 500);
}, false);
}
else {
document.addEventListener("load", function () {
window.setTimeout("ResizeHeight('" + getwpName() + "')", 500);
}, false);
}
</script>
댓글 없음:
댓글 쓰기