1. 程式人生 > >jsp頁面 隱藏和顯示內容

jsp頁面 隱藏和顯示內容

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script> 
    </head>
    
    <script type="text/javascript">
    	
    	function yincang(){
    		
    		$("div a:first").css("display","none");
    		
    	}
    	
    	function xianshi(){
    		$("div a:first").show();
    	}
    	
    </script>
    
    <body>
    	<div>
    	<a>小心</a>
		<a>小心1</a>
		<a>小心2</a>
		<a>小心3</a>
		<a>小心4</a>
    	</div>
    	<input type="button" onclick="yincang()" id="btn1" value="隱藏"/>
    	<input type="button" onclick="xianshi()" id="btn2" value="顯示"/>
 	</body>
</html>