日期:2014-05-17  浏览次数:20918 次

这段JSP页面的JS脚本为什么不执行?
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.sailing.servlet.*"%>
<%@ page import="java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="main.css" type="text/css" rel="stylesheet" media="all"/>
<title>明信片首页</title>
</head>

<body style=" font-family:'微软雅黑'" onload="search()">
  <script language="javascript"> 
function update()
{
var form = document.getElementById("main_form");
form.action = "update.jsp?action=main_update;
form.submit;
}
function search()
{
alert("zcsda");
//var form = document.getElementById("main_form");
//form.action = "PostCard?action=search";
//form.submit;
}
function deletes()
{
var form = document.getElementById("main_form");
form.action = "PostCard?action=delete";
form.submit;
}
</script>
<form method="post" name="main_form" id="main_form">
<%
DBCtrol dbctrol = new DBCtrol();
SetGet sg = new SetGet();
String name = null,duty = null,newtime = null,classs = null,remark = null,del_hint = null,update_hint = null,insert_hint=null;
int id=0;
insert_hint = (String)request.getAttribute("insert_hint");
del_hint = (String)request.getAttribute("del_hint");
update_hint = (String)request.getAttribute("update_hint");
request.setCharacterEncoding("GB2312");
List list = dbctrol.getPostCard();
int k = list.size();
%>
<table id="all" border="1" align="center">
<tr>
  <td colspan="6">明信片列表</td>
  </tr>
  <tr>
  <td>ID</td>
  <td id="name">姓名</td>
  <td id="duty">职务</td>
  <td id="newtime">新增时间</td>
  <td id="class">级别</td>
  <td id="remark">备注</td>
  </tr>
  <%
  for(int i=0;i<k;i++)
  {
sg = (SetGet)list.get(i);
id = sg.getId();
name = sg.getName();
duty = sg.getDuty();
newtime = sg.getNewtime();
classs = sg.getClasss();
remark = sg.getRemark();
%>
  <tr>
  <td><%=id%></td>
  <td><%=name%></td>
  <td><%=duty%></td>
  <td><%=newtime%></td>
  <td><%=classs%></td>
  <td><%=remark%></td>
  </tr>
  <%
  }
  %>

  <tr>
  <td>操作</td>
  <td colspan="5" style="text-align:left;">
  <input type="button" name="button_insert" value="新增" onclick="window.location.href='index.jsp'"/>