jsp页面的问题
来源:百度知道 编辑:UC知道 时间:2024/06/20 07:02:27
我的页面每次访问的时候,为什么js中的function都自动运行啊?我也没点onclick按钮啊?
<%@ page language="java" import="java.util.*,model.*"
pageEncoding="gb2312"%>
<script type="text/javascript">
function substart(){
var b='<%WorkModel.getInstance().addstart(1)%>';
if(b='true'){
window.location.href("MyJsp.jsp");
}else{
window.status="your have clicked a button!"
}
//window.location.href("MyJsp.jsp");
}
function subend(){
var b1='<%WorkModel.getInstance().addend(1)%>';
if(b1='true'){
window.location.href("MyJsp.jsp");
}else{
window.status="your have clicked a button!"
}
}
<%String starttime = TimeModel.getInstance().selstart();
String endtime = TimeModel.getInstance().selend();
String
<%@ page language="java" import="java.util.*,model.*"
pageEncoding="gb2312"%>
<script type="text/javascript">
function substart(){
var b='<%WorkModel.getInstance().addstart(1)%>';
if(b='true'){
window.location.href("MyJsp.jsp");
}else{
window.status="your have clicked a button!"
}
//window.location.href("MyJsp.jsp");
}
function subend(){
var b1='<%WorkModel.getInstance().addend(1)%>';
if(b1='true'){
window.location.href("MyJsp.jsp");
}else{
window.status="your have clicked a button!"
}
}
<%String starttime = TimeModel.getInstance().selstart();
String endtime = TimeModel.getInstance().selend();
String
有可能的情况是浏览器的问题,也有可能是你后台代码的逻辑问题。
我讲你的代码还原成纯HTML如下,你看看。
<script type="text/javascript">
function substart(){
var b='true';
if(b='true'){
window.location.href("http://www.sina.com.cn");
}else{
window.status="your have clicked a button!"
}
//window.location.href("MyJsp.jsp");
}
function subend(){
var b1='false';
if(b1='true'){
window.location.href("http://www.yahoo.com");
}else{
window.status="your have clicked a button!"
}
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<tit