web工程jsp中超链接,按钮onclick失效。但是我新建另外一个工程中,同样的代码去好用,调用alert也成功
<%@pagelanguage="java"import="java.util.*,hetong.domain.*,hetong.dao.*"pageEncoding="...
<%@ page language="java" import="java.util.*,hetong.domain.*,hetong.dao.*" pageEncoding="UTF-8"%>
<script type="text/javascript">
function test(){
alert("success");
}
function submitPage(obj, evt){
evt = (evt)?evt:((window.event)?window.event:"");
keyCode = evt.keyCode ? evt.keyCode : (evt.which ? evt.which : evt.charCode);
if (keyCode == 13) {
document.forms[1].submit();
}
</script>
</head>
<body>
<h3> <u>分包合同>>基本信息</u></h3>
<table width="80%" border="0" cellspacing="1" cellpadding="1">
<tr>
<th width="10%" align="left" scope="row">分包合同号</th>
<td width="20%" align="center"><label>
<input type="text" name="subContractNo" id="subContractNo" />
</label></td>
<td width="20%" align="left">
<input type="button" name="Submit" value="查询" onclick="test();"/>
</td>
<td width="20%" align="left">
<input type="button" name="back" value="返回" onclick="javascript:window.location.href='fbhtchakan.jsp'"/>
</td>
</tr>
</table>
<table width="80%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td>分包合同号</td><td>接受日期</td><td>项目名称</td><td>销售合同号</td>
<td>工作令号</td><td>备注</td><td>详细</td><td>修改</td>
</tr>
<%
int PageSize; int RowCount; int PageCount; int intPage; int i,j; PageSize = 5; String strPage = request.getParameter("page");
if(strPage==null) intPage =1; }else{ intPage=Integer.parseInt(strPage);
if(intPage<1){ intPage=1; } }
FenbaoDao dao = new FenbaoDao();
ArrayList<Fenbao> list = dao.li();
RowCount=list.size();
PageCount=(RowCount-1)/PageSize+1;
if(intPage>PageCount){
intPage=PageCount;
}
i=(intPage-1)*PageSize;
for(j=i;j<RowCount&&j<i+PageSize;j++)
{
Fenbao fenbao = list.get(j);
out.println("<tr>");
try{
out.println("<td>"+ fenbao.getSubContractNo() +"</td>");
out.println("<td>"+ fenbao.getReceiptDate() +"</td>");
out.println("<td>"+ fenbao.getProjectName() +"</td>");
out.println("<td>"+ fenbao.getContractNo()+"</td>");
out.println("<td>"+ fenbao.getProductNo()+"</td>");
out.println("<td>"+ fenbao.getNotes()+"</td>");
out.println("<td><a href=\"javascript:void(0);\" onclick=\"javascript:test();\">详细</a></td>");
out.println("<td><a href=\"fbhtxiugai.jspSubcontractNo="+fenbao.getSubContractNo()+"\">修改</a></td>");
}
catch(Exception e){}
out.println("</tr>");
}
%>
</table>
<td colspan=6 align=center>
<form name="frmPage" action="fbhtjiben.jsp" method="get">
回车转到第 <input type="text" name="page" size="3" onKeyPress="submitPage(this,event)" />页
</form>
第 <%=intPage%> 页 共 <%=PageCount%> 页 共有 <%=RowCount%> 条记录
<%
if(intPage> 1)
{
%> <a href="fbhtjiben.jsp?page=<%=intPage-1%>">上一页 </a> <%
}
%>
<%
if(intPage <PageCount)
{
%> <a href="fbhtjiben.jsp?page=<%=intPage+1%>">下一页 </a> <%
}
%> 少些部分代码 展开
<script type="text/javascript">
function test(){
alert("success");
}
function submitPage(obj, evt){
evt = (evt)?evt:((window.event)?window.event:"");
keyCode = evt.keyCode ? evt.keyCode : (evt.which ? evt.which : evt.charCode);
if (keyCode == 13) {
document.forms[1].submit();
}
</script>
</head>
<body>
<h3> <u>分包合同>>基本信息</u></h3>
<table width="80%" border="0" cellspacing="1" cellpadding="1">
<tr>
<th width="10%" align="left" scope="row">分包合同号</th>
<td width="20%" align="center"><label>
<input type="text" name="subContractNo" id="subContractNo" />
</label></td>
<td width="20%" align="left">
<input type="button" name="Submit" value="查询" onclick="test();"/>
</td>
<td width="20%" align="left">
<input type="button" name="back" value="返回" onclick="javascript:window.location.href='fbhtchakan.jsp'"/>
</td>
</tr>
</table>
<table width="80%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td>分包合同号</td><td>接受日期</td><td>项目名称</td><td>销售合同号</td>
<td>工作令号</td><td>备注</td><td>详细</td><td>修改</td>
</tr>
<%
int PageSize; int RowCount; int PageCount; int intPage; int i,j; PageSize = 5; String strPage = request.getParameter("page");
if(strPage==null) intPage =1; }else{ intPage=Integer.parseInt(strPage);
if(intPage<1){ intPage=1; } }
FenbaoDao dao = new FenbaoDao();
ArrayList<Fenbao> list = dao.li();
RowCount=list.size();
PageCount=(RowCount-1)/PageSize+1;
if(intPage>PageCount){
intPage=PageCount;
}
i=(intPage-1)*PageSize;
for(j=i;j<RowCount&&j<i+PageSize;j++)
{
Fenbao fenbao = list.get(j);
out.println("<tr>");
try{
out.println("<td>"+ fenbao.getSubContractNo() +"</td>");
out.println("<td>"+ fenbao.getReceiptDate() +"</td>");
out.println("<td>"+ fenbao.getProjectName() +"</td>");
out.println("<td>"+ fenbao.getContractNo()+"</td>");
out.println("<td>"+ fenbao.getProductNo()+"</td>");
out.println("<td>"+ fenbao.getNotes()+"</td>");
out.println("<td><a href=\"javascript:void(0);\" onclick=\"javascript:test();\">详细</a></td>");
out.println("<td><a href=\"fbhtxiugai.jspSubcontractNo="+fenbao.getSubContractNo()+"\">修改</a></td>");
}
catch(Exception e){}
out.println("</tr>");
}
%>
</table>
<td colspan=6 align=center>
<form name="frmPage" action="fbhtjiben.jsp" method="get">
回车转到第 <input type="text" name="page" size="3" onKeyPress="submitPage(this,event)" />页
</form>
第 <%=intPage%> 页 共 <%=PageCount%> 页 共有 <%=RowCount%> 条记录
<%
if(intPage> 1)
{
%> <a href="fbhtjiben.jsp?page=<%=intPage-1%>">上一页 </a> <%
}
%>
<%
if(intPage <PageCount)
{
%> <a href="fbhtjiben.jsp?page=<%=intPage+1%>">下一页 </a> <%
}
%> 少些部分代码 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询