Javascript to display and hide information
Information Display and hiding are usually used in some cases, such as registration information. The following is a good example. If you are interested, you can understand it.
When writing the registration page, the required information is visible and optional information is hidden. If you want to enter the required information, click "details ".
The Code is as follows:
<! -- The following code uses javascript to display and hide information -->
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Title> Insert title here </title>
<Script type = "text/javascript">
Function $ (idvalue ){
Return document. getElementById (idvalue );
}
Function showtext (){
If ($ ('text'). style. display = 'None '){
$ ('Text'). style. display = '';
} Else {
$ ('Text'). style. display = 'none ';
}
}
</Script>
</Head>
<Body>
<Div id = "text" style = "display: none;"> here is the hidden information </div>
<Button id = "morebtn" onclick = "showtext ();"> details </button>
</Body>
</Html>