On the Asp.net page, the menu control drop-down menu is blocked by frame and the IFRAME adaptive Height Solution

Source: Internet
Author: User
When you are building a Windows-like Program When using the top menu frame, you may use two frames in Asp.net. One frame is used for serving a single frame on the top and the other is used for clicking the menu to open the page below. the page implementation is very simple. When you run a single task, you will find that the frame where you put the menu blocks the following menu and cannot reach the frame below. to solve the blocking problem, frame cannot be used. By placing a menu and an IFRAME in a separate Asp.net page, the drop-down menu will not be blocked at this point, there is another new problem, that is, the height of the IFRAME. If it is forced to die, it is unacceptable. if yes? The solution is to use JavaScript to control the IFRAME height in the onload and onsized events of the body. Code Solve the problem above.

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default5.aspx. cs" inherits = "default5" %>

<HTML>
<Head runat = "server">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> No title page </title>

<Script language = "JavaScript" type = "text/JavaScript">

Function AAAAA ()
{

Document. getelementbyid ('f1'). Height = Document. Body. clientHeight-80;
}

</SCRIPT>

</Head>
<Body Onload = "AAAAA ()" onresize = "AAAAA ()" scroll = "no" Style = "margin: 0">
<Form ID = "form1" runat = "server">
<Table>
<Tr>
<TD Height = "80">
<Asp: menu id = "menu1" runat = "server" orientation = "horizontal" backcolor = "# e3eaeb"
Dynamichorizontaloffset = "2" font-names = "verdana" font-size = "0.8em" forecolor = "#666666"
Staticsubmenuindent = "10px">
<Staticselectedstyle backcolor = "#1c5e55"/>
<Staticmenuitemstyle horizontalpadding = "5px" verticalpadding = "2px"/>
<Dynamichoverstyle backcolor = "#666666" forecolor = "white"/>
<Dynamicmenustyle backcolor = "# e3eaeb"/>
<Dynamicselectedstyle backcolor = "#1c5e55"/>
<Dynamicmenuitemstyle horizontalpadding = "5px" verticalpadding = "2px"/>
<Statichoverstyle backcolor = "#666666" forecolor = "white"/>
<Items>
<Asp: menuitem text = "new item 1" value = "new item 1">
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item">
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
</ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
<Asp: menuitem text = "new item" value = "new item"> </ASP: menuitem>
</ASP: menuitem>
<Asp: menuitem text = "new item 2" value = "new item 2"> </ASP: menuitem>
<Asp: menuitem text = "new item 3" value = "new item 3"> </ASP: menuitem>
</Items>
</ASP: menu>
</TD>
</Tr>
</Table>
<IFRAME id = "f1" scrolling = "Auto" width = "100%" Height = "200" src = "htmlpage5.htm"> </iframe>
</Form>
</Body>
</Html>

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.