The ifram framework adapts to highly JavaScript implementations

Source: Internet
Author: User

<SCRIPT type = "text/JavaScript">
// Framework self-application height
Function Dyniframesize (down) {
VaR ptar = NULL;
If (document. getelementbyid ){
Ptar = Document. getelementbyid (down );
}
Else {
Eval ('ptar = '+ down + ';');
}
If (ptar &&! Window. Opera ){
// Begin resizing IFRAME
Ptar. style. Display = "Block"
If (ptar. contentdocument & ptar. contentdocument. Body. offsetheight ){
// Ns6 syntax
Ptar. Height = ptar. contentdocument. Body. offsetheight + 20;
Ptar. width = ptar. contentdocument. Body. scrollwidth + 20;
}
Else if (ptar. Document & ptar. Document. Body. scrollheight ){
// Ie5 + syntax
Ptar. Height = ptar. Document. Body. scrollheight;
Ptar. width = ptar. Document. Body. scrollwidth;
}
}
}
</SCRIPT>

 

Set in ifram:

<IFRAME Style = "vertical-align: Top; padding-left: 0px; Height: 447px; width: 720px;
Background-color: # eaeeed"Onload = "javascript: dyniframesize ('workspace ');" Id = "workspace"
Marginwidth = "0" scrolling = "no" frameborder = "0" name = "ifram" src = "companymanage. aspx">
</Iframe>

The above method is;

The following method is not restricted by the height you set:

<SCRIPT type = "text/JavaScript">

If (window! = Top) top. Location = Window. location;
// Adjust the size of the table ‑ topframe so that the IFRAME workspace does not display a scroll bar.
Function workspaceload (){
VaR H = workspace.doc ument. Body. scrollheight;
If (h> 450)
Parent. Partition topframe. Height = h;
Parent.doc ument. All. workspace. style. Height = h;


}

</SCRIPT>

Set on a table with a frame:

<Table width = "100%" id = "comment topframe">

<Tr>

<TD>

<IFRAME Style = "vertical-align: Top; padding-left: 0px; width: 725px;
Background-color: # eaeeed "id =" workspace "onLoad =" javascript: workspaceload ();"
Marginwidth = "0" scrolling = "no" frameborder = "0" name = "ifram" src = "companymanage. aspx">
</Iframe>

</TD>

</Tr>

</Table>

but both methods are limited by the first width, that is, when you are on the same page, there are different operations, and the first operation shows less content, the second operation shows a lot of content. If you operate the first operation, the page framework will not be automatically applied when you operate the second operation. This problem has been stuck for a long time, if you know how to handle this problem, please share it. Thank you very much,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.