<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<% String cp = request.getContextPath();%>
<title>Insert title here</title>
<script>
function fun(){
window.location.href="<%=cp %>/OnloadServlet";
}
function test(){
<%System.out.println("test");%>
}
function test1(){
<%System.out.println("test1");%>
}
</script>
</head>
<body onload="fun()">
</body>
</html>
异常:每次load页面时 test(),test1()的方法就会执行,请问是为什么呢?
相关分类