日期:2014-05-17  浏览次数:20924 次

jquery与js隐藏和显示的问题,我用这两种方法都现实不了为什么?
<%@ 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 'index.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">
-->
<script type="text/javascript" src="/jquery/js/jquery-1.3.1.js"></script>
<script type="text/javascript">
function ckl()
{

}
function ss()
{
$("one").css("display","none");
$("two").css("display","block");
}
function dosth(){

document.getElementById("two").style.display="block";
document.getElementById("one").style.display="none";
}

</script>

  </head>
  
  <body>
  <div id="one">
  <form action="/jquery/login" method="post">
 
  <table align="center" id="tbllogin">
  
  <tr>
  <td>用户名:</td>
  <td><input type="text" name="u.name"/></td>
  </tr>
  <tr>
  <td>密码:</td>
  <td><input type="password" name="u.password"/></td>
  </tr>
  <tr>
  <td><input type="button" value="提交"/></td>
  <td><input type="button" value="注册" id="btnReg" onclick="dosth()" /></td>
  </tr>
  
  </table>
  </form>
  </div>
  <div id="two" style="display:none">
   
  <table align="center" id="tblregist">
  <form action="/jquery/redist" method="post">
  <tr>
  <td>用户名:</td>
  <td><input type="text" name="u.name"/></td>
  </tr>
  <tr>
  <td>密码:</td>
  <td><input type="password" name="u.password"/></td>
  </tr>
  <tr>
  <td colspan="2"><input type="button" value="提交"/></td>
 
  </tr>
 

  </form>
  </table>
  </div>
  </body>
</html>
我用方法dosth()或ss()都实现不了一个现