Uncaught SyntaxError: Unexpected token .

皇子疯 2015-06-09 03:33:01
这是我的jsp代码

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String code = "12345678910123456789105";//条形码内容
int wdith=100; //设置宽
int height=20; //设置高

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript">
<!--
NS4 = (document.layers) ? 1 : 0;
visble_property_prefix = (NS4) ? "document.layers." : "";
visble_property_suffix = (NS4) ? ".visibility" : ".style.display";
visble_property_true = (NS4) ? "show" : "block";
visble_property_false = (NS4) ? "hide" : "none";
visble_property_printview = visble_property_prefix + "viewpanel" + visble_property_suffix;
function nowprint() {

window.print();
}

function window.onbeforeprint() {
eval(visble_property_printview + " = \"" + visble_property_false + "\"");
}
function window.onafterprint() {
eval(visble_property_printview + " = \"" + visble_property_true + "\"");
}
//-->
</script>
</head>
<body topmargin="0px" leftmargin="0px" rightmargin="0px" bottommargin="0px">
<%
StringBuffer barCode = new StringBuffer();
barCode.append("<img src='");
barCode.append(request.getContextPath());
barCode.append("/CreateBarCode?code=");
barCode.append(code);
barCode.append("&barType=CODE128&checkCharacter=n&checkCharacterInText=n'>");
out.println(barCode.toString());
%>
<div id="viewpanel" align="center">
<input name="bequery" type="button" value="打 印" style="cursor:hand;" onclick="nowprint();">
</div>
<!--script>nowprint();</script-->
</body>
</html>

出错




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript">
<!--
NS4 = (document.layers) ? 1 : 0;
visble_property_prefix = (NS4) ? "document.layers." : "";
visble_property_suffix = (NS4) ? ".visibility" : ".style.display";
visble_property_true = (NS4) ? "show" : "block";
visble_property_false = (NS4) ? "hide" : "none";
visble_property_printview = visble_property_prefix + "viewpanel" + visble_property_suffix;
function nowprint() {

window.print();
}

function window.onbeforeprint() {-->访问刷新出错
eval(visble_property_printview + " = \"" + visble_property_false + "\"");
}
function window.onafterprint() {
eval(visble_property_printview + " = \"" + visble_property_true + "\"");
}
//-->
</script>
</head>
<body topmargin="0px" leftmargin="0px" rightmargin="0px" bottommargin="0px">
<img src='/ImageUpload/CreateBarCode?code=12345678910123456789105&barType=CODE128&checkCharacter=n&checkCharacterInText=n'>

<div id="viewpanel" align="center">
<input name="bequery" type="button" value="打 印" style="cursor:hand;" onclick="nowprint();">-->单击打印按钮时出错
</div>
<!--script>nowprint();</script-->
</body>
</html>














...全文
255 回复 打赏 收藏 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,984

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧