JavaScript code:
Code
Copy Code code as follows:
function Expandother (el, El2) {
Whichel = document.getElementById (EL)
button = document.getElementById (EL2)
if (WhichEl.style.display = = ' None ') {
WhichEl.style.display = ';
Button.value = "hidden";
}
else {
WhichEl.style.display = ' None ';
Button.value = "Display";
}
Expandother (E1,el2),
The e1 parameter can specify the event object that needs to be manipulated, such as an input button with an ID of inputshowdata.
The EL2 parameter can specify an area that needs to be hidden, such as Table,div.
<input name= "Inputshowdata" id= "Inputshowdata" value= "type=" button "onclick=" Expandother (' datadiv ', ' Inputshowdata ') "/>
ID is datadiv data display layer Area
ID is inputshowdata action button
HTML Sample code:
Copy Code code as follows:
<fieldset>
<legend>
<input name= "Inputshowdata" id= "Inputshowdata" value= "type=" button "onclick=" Expandother (' datadiv ', ' Inputshowdata ') "/></legend>
<div id= "Datadiv" style= "width:400px; height:100px; Overflow:auto; " >
<asp:gridview id= "GridView1" runat= "Server" cellpadding= "4" forecolor= "#333333" gridlines= "None" >
<rowstyle backcolor= "#F7F6F3" forecolor= "#333333"/>
<footerstyle backcolor= "#5D7B9D" font-bold= "True" forecolor= "white"/>
<pagerstyle backcolor= "#284775" forecolor= "white" horizontalalign= "Center"/>
<selectedrowstyle backcolor= "#E2DED6" font-bold= "True" forecolor= "#333333"/>
<editrowstyle backcolor= "#999999"/>
<alternatingrowstyle backcolor= "White" forecolor= "#284775"/>
</asp:GridView>
</div>
</fieldset>
Is it easy to find out?
Personally feel.
However, this layer has scroll bars, mainly based on the style attribute Overflow:auto, and has the specified width and height.
If you do not specify the width directly, the scroll bar is displayed as a standard for the browser width.
If you do not specify a height, the downward scroll bar is not displayed, as appears to be the case. I do not do the art. Today's right when recorded here, later you can look back at that time how you understand and write code.