jsp中的table隐藏与显示

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'MyJsp.jsp' starting page</title>
   
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 <meta http-equiv="description" content="This is my page">
 <!--
 <link rel="stylesheet" type="text/css" href="styles.css">
 -->

  </head>
 
  <body>
    <title>一个简单的点击后显示与隐藏表格的例子</title>
<script type="text/javascript">
function toggle( targetId ) {
if (document.getElementById){
 target = document.getElementById( targetId );
  if ( target.style.display == "none") {
   target.style.display = "";
  } else {
   target.style.display = "none";
  }
 }
}
</script>

<body>
<table width="355" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="30" bgcolor="#FFFFFF"><input name="aa" type="button" value="确定" onclick="toggle('aaa');" />
点这里显示/隐藏 </td>
  </tr>
  <tr id="aaa">
    <td height="30" bgcolor="#F3F3F3"> </td>
  </tr>
</table>
  </body>
</html>

posted @ 2012-02-13 22:47  啊孟  阅读(4016)  评论(0编辑  收藏  举报