| 熊薇 发表于 2013-4-12 22:21 ![]() 检查下fy()方法有没有被调用;
 var inputIdElement = document.getElementById("inputId");
 检查下控件的id ...
value是从文本框输入的,,当我输入跳转的时候显示,undefined。。复制代码<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
          <script type="text/javascript">
                function fy(){
                        var inputIdElement = document.getElementById("inputId");
                        var currentPageNum = inputIdElement.Value;
                        var url = "/crm/CrmServlet?method=findAllCustomer¤tPageNum="+currentPageNum;
                        window.location.href=url;
                }
        </script>
              <table border="1" align="center">
                   <caption><h1>客户信息</h1></caption>
                   <tr>
                           <th>状态</th>
                           <th>姓名</th>
                           <th>性别</th>
                           <th>地址</th>
                           <th>电话</th>
                           <th>邮箱</th>
                           <th>生日</th>
                   </tr>
                   <c:forEach var="customer" items="${page.crmList}">
                           <tr>
                                   <th><input type="checkbox" value="${customer.id }"/></th>
                                   <th>${customer.name }</th>
                                   <th>${customer.gender }</th>
                                   <th>${customer.address }</th>
                                   <th>${customer.tel }</th>
                                   <th>${customer.email }</th>
                                   <th>${customer.birthday }</th>
                           </tr>
                   </c:forEach>
                   <tr>
                           <td colspan="7" align="center">
                                   <input type="text" name="currentPageNum" id="inputId"/>
                                   <input type="button" value="Go" onclick="fy()"/>
                           </td>
                   </tr>
           </table>
  </body>
</html>
帮帮忙,,
 |