jsp页面中 查询界面 如何使用回车 来提交查询条件 我的jsp页面如下
<%@pagelanguage="java"import="java.util.*"pageEncoding="utf-8"%><%@tagliburi="/struts...
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>查询信息--学生信息管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jQuery/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/myjs.js"></script>
</head>
<body>
<div id="wrap">
<div id="top_content">
<div id="header">
<div id="rightheader">
<p>
<s:property value="date"/>
<br />
</p>
</div>
<div id="topheader">
<h1 id="title">
查询
</h1>
</div>
<div id="navigation">
</div>
</div>
<div id="content">
<p id="whereami">
</p>
<h1>
查询学生信息:
</h1>
<form action="selectStuInfo.action" method="post">
<table cellpadding="0" cellspacing="0" border="0"
class="form_table">
<tr>
<td valign="middle" align="right">
姓名:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="name" id="name"/>
<div class="examine"><span id="checkName"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
班级:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="class_" id="class_"/>
<div class="examine"><span id="checkClass_"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
学号:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="stuId" id="stuId" onblur="checkStuId()"/>
<div class="examine"><span id="checkSId"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
是否精确查询:
</td>
<td valign="middle" align="left">
<select name="select" id="select" onchange="changeSelect()">
<option value="0"></option>
<option value="1">是</option>
<option value="2">否</option>
</select>
<div class="examine"><span id="checkSelect"></span></div>
</td>
</tr>
</table>
<p>
<input type="submit" class="button" value="查询" />
<input type="button" class="button" value="清空" onclick="clearSelect()"/>
</p>
</form>
</div>
</div>
<div id="footer">
<div id="footer_bg">
liuqiang2415@126.com
</div>
</div>
</div>
</body>
</html> 展开
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>查询信息--学生信息管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jQuery/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/myjs.js"></script>
</head>
<body>
<div id="wrap">
<div id="top_content">
<div id="header">
<div id="rightheader">
<p>
<s:property value="date"/>
<br />
</p>
</div>
<div id="topheader">
<h1 id="title">
查询
</h1>
</div>
<div id="navigation">
</div>
</div>
<div id="content">
<p id="whereami">
</p>
<h1>
查询学生信息:
</h1>
<form action="selectStuInfo.action" method="post">
<table cellpadding="0" cellspacing="0" border="0"
class="form_table">
<tr>
<td valign="middle" align="right">
姓名:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="name" id="name"/>
<div class="examine"><span id="checkName"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
班级:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="class_" id="class_"/>
<div class="examine"><span id="checkClass_"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
学号:
</td>
<td valign="middle" align="left">
<input type="text" class="inputgri" name="stuId" id="stuId" onblur="checkStuId()"/>
<div class="examine"><span id="checkSId"></span></div>
</td>
</tr>
<tr>
<td valign="middle" align="right">
是否精确查询:
</td>
<td valign="middle" align="left">
<select name="select" id="select" onchange="changeSelect()">
<option value="0"></option>
<option value="1">是</option>
<option value="2">否</option>
</select>
<div class="examine"><span id="checkSelect"></span></div>
</td>
</tr>
</table>
<p>
<input type="submit" class="button" value="查询" />
<input type="button" class="button" value="清空" onclick="clearSelect()"/>
</p>
</form>
</div>
</div>
<div id="footer">
<div id="footer_bg">
liuqiang2415@126.com
</div>
</div>
</div>
</body>
</html> 展开
2个回答
展开全部
<form name="selectStuInfoForm" action="selectStuInfo.action" method="post" onkeydown="javascript: if (event.keyCode == 13){return check();}">郑哗并
<input type="button" class="芦戚button" value="查询" onclick="check()"/>
check();为js函数 用来检验表喊迹单基本信息输入是否合法的!
fuction check(){
//检验.....
if(true){
document.selectStuInfoForm.submit();
}else{
return false;
}
}
如不需验证 函数里直接提交表单就好!
<input type="button" class="芦戚button" value="查询" onclick="check()"/>
check();为js函数 用来检验表喊迹单基本信息输入是否合法的!
fuction check(){
//检验.....
if(true){
document.selectStuInfoForm.submit();
}else{
return false;
}
}
如不需验证 函数里直接提交表单就好!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询