javascript总是提醒缺少分号 5

<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"errorP... <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.bcs.dao.TbBookcaseDAO" %>
<%@ page import="com.bcs.pojo.TbBookcase" %>
<html>
<head>
<title>添加书架信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
</head>
<script type="text/javascript">
function add()
{
TbBookcase bookcase = new TbBookcase();//这里总是提示缺少分号,求大神赐教 小弟新人
TbBookcaseDAO bcd = new TbBookcaseDAO();
if(form.name.value == " ")
{
alert("请输入书架名称!");
}
else
{
int max = bcd.MaxId();
bookcase.setBookcaseId(max + 1);
bookcase.setsetBookcaseName(form.name.value);
bookcase.setDescription(form.descrption.value);
bcd.save(bookcase);
alert("书架添加成功!");
window.close();
}
}
</script>
<body>
<table width="292" height="175" border="0" cellpadding="0" cellspacing="0" background="Images/subBG.jpg">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3%" height="25"><br></td>
<td width="94%"> </td>
<td width="3%"> </td>
</tr>
<tr>
<td> </td>
<td><table width="100%" height="131" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><form name="form1" method="post" action="bookcaseAdd">
<table width="269" height="175" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="74" align="center">书架名称:<input name="name" type="text"></td>
</tr>
<tr>
<td height="74" align="center">书架描述:<input name="descrption" type="text"></td>
</tr>
<tr>
<td align="center"> <input type="button" name="Submit3" class="btn_grey" value="保存" onClick="add()"><input type="button" name="Submit22" class="btn_grey" value="关闭" onClick="window.close()"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</table></td>
</tr>
</table>
</body>
</html>
展开
 我来答
马后雷鼓下扬州5058
2013-04-02 · TA获得超过4321个赞
知道小有建树答主
回答量:693
采纳率:33%
帮助的人:810万
展开全部
出错的地方是下面三句

TbBookcase bookcase = new TbBookcase();
TbBookcaseDAO bcd = new TbBookcaseDAO();

int max = bcd.MaxId();

如果这是 Javascript 脚本,那么使用 var 声明变量,转换整数的函数是 parseInt。

TbBookcase.bookcase = new TbBookcase();
TbBookcaseDAO.bcd = new TbBookcaseDAO();

var max = parseInt(bcd.MaxId());

如果是 Java, 楼下的回答应该是正确的。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2013-04-01
展开全部
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.bcs.dao.TbBookcaseDAO" %>
<%@ page import="com.bcs.pojo.TbBookcase" %>
<html>
<head>
<title>添加书架信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
</head>
<script type="text/javascript">
function add()
{

// 小脚本开始

<%

TbBookcase bookcase = new TbBookcase();//这里总是提示缺少分号,求大神赐教 小弟新人
TbBookcaseDAO bcd = new TbBookcaseDAO();
%>
// 小脚本结束

if(form.name.value == " ")
{
alert("请输入书架名称!");
}
else
{
// 小脚本开始

<%

int max = bcd.MaxId();
bookcase.setBookcaseId(max + 1);
bookcase.setsetBookcaseName(form.name.value);
bookcase.setDescription(form.descrption.value);
bcd.save(bookcase);
%>
// 小脚本结束

alert("书架添加成功!");
window.close();
}
}
</script>
<body>
<table width="292" height="175" border="0" cellpadding="0" cellspacing="0" background="Images/subBG.jpg">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3%" height="25"><br></td>
<td width="94%"> </td>
<td width="3%"> </td>
</tr>
<tr>
<td> </td>
<td><table width="100%" height="131" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><form name="form1" method="post" action="bookcaseAdd">
<table width="269" height="175" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="74" align="center">书架名称:<input name="name" type="text"></td>
</tr>
<tr>
<td height="74" align="center">书架描述:<input name="descrption" type="text"></td>
</tr>
<tr>
<td align="center"> <input type="button" name="Submit3" class="btn_grey" value="保存" onClick="add()"><input type="button" name="Submit22" class="btn_grey" value="关闭" onClick="window.close()"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</table></td>
</tr>
</table>
</body>
</html>

——————————————————————————————————————

注意使用小脚本时务这样: <% Your Java Code %>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式