大众信息网

求大哥帮我看一下 为什么我定义的 button 触发onclick 事件 不能进行跳转 代码我全部贴出来了 代码不多

关注:220  答案:3  手机版
解决时间 2021-01-17 15:14
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<title>My JSP 'MyJsp.jsp' starting page</title>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript">

function select(){
//组合查询

document.forms[0].action="MyJsp2.jsp";
document.forms[0].submit();
}

</script>

<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>
最佳答案
相对路径MyJsp2.jsp要加“/”的啊,记住,程序是要根据路径去寻找你的jsp的,不是文件名。
全部回答
可以执行啊,即使函数已存在也会被覆盖的,为什么不能执行,是不是代码写的有问题
把你的<script>...</script>和<input type="button" ... />什么的贴出来就好啦,其实用超链接不是更方便
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!