Javascript implements the display and hiding of information such as the registration page

  • 2020-03-30 00:41:10
  • OfStack

When we write the registration page, the required information is visible, the optional information is hidden, if the user wants to fill in, you can click "details".
 
<!--  The following code is passed javascript Implement the display and hiding of 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();"> The detailed information </button> 
</body> 
</html> 

Related articles: