今天集成测试是发现一个初始化界面时报错,于是开始排查。
公司的界面框架如下:
<head >
<SCRIPT src="./GEdorTypeXS.js"></SCRIPT>
<%@include file="GEdorTypeXSInit.jsp"%>
</head>
<body οnlοad="initForm();initElementtype();" >
<form action="./GEdorTypeXSSubmit.jsp" method=post name=fm target="fraSubmit">
</form>
</body>
在初始化时通过initForm()方法调用GEdorTypeXS.js中的其他方法,initForm()方法如下:
function initForm()
{
try
{
EdorQuery();
initInpBox();
initInsuredOldGrid();
initInsuredZTGrid();
queryClick();
queryClick2();
queryReason();
initModifyForm();
}
catch (ex)
{
alert("在 GEdorTypeXSInit.jsp --> initForm 函数中发生异常:初始化界面错误! ");
}
}
我在initForm()第一句写了个alert(1),在EdorQuery()的第一句也写了个alert(2),结果在初始化时只有alert(1)有显示,而alert(2)没有。百思不得其解。请教老手。老手排查一遍后也没发现问题,于是他对GEdorTypeXS.js的版本做了对比,注意这一步,当时我认为他对比版本是浪费时间,理由是我以为[b]js文件如果有语法错误在编译时会报错[/b],[b][color=red]这是不对的[/color][/b]。经过版本对比后发现是一个同事修改时大意:
if(count1==1){
if (!getmoneycheck()) return;
// if (!getsummoney()) return ;}
将外层if语句的右大括号注掉了。
总结:
1.js文件语法错误编译时不报错
2.js文件方法a()中存在语法错误,调用其中b()方法也会报错
3.如果一个问题显示的排查没有结果,一定要看一下上次别人改过什么
公司的界面框架如下:
<head >
<SCRIPT src="./GEdorTypeXS.js"></SCRIPT>
<%@include file="GEdorTypeXSInit.jsp"%>
</head>
<body οnlοad="initForm();initElementtype();" >
<form action="./GEdorTypeXSSubmit.jsp" method=post name=fm target="fraSubmit">
</form>
</body>
在初始化时通过initForm()方法调用GEdorTypeXS.js中的其他方法,initForm()方法如下:
function initForm()
{
try
{
EdorQuery();
initInpBox();
initInsuredOldGrid();
initInsuredZTGrid();
queryClick();
queryClick2();
queryReason();
initModifyForm();
}
catch (ex)
{
alert("在 GEdorTypeXSInit.jsp --> initForm 函数中发生异常:初始化界面错误! ");
}
}
我在initForm()第一句写了个alert(1),在EdorQuery()的第一句也写了个alert(2),结果在初始化时只有alert(1)有显示,而alert(2)没有。百思不得其解。请教老手。老手排查一遍后也没发现问题,于是他对GEdorTypeXS.js的版本做了对比,注意这一步,当时我认为他对比版本是浪费时间,理由是我以为[b]js文件如果有语法错误在编译时会报错[/b],[b][color=red]这是不对的[/color][/b]。经过版本对比后发现是一个同事修改时大意:
if(count1==1){
if (!getmoneycheck()) return;
// if (!getsummoney()) return ;}
将外层if语句的右大括号注掉了。
总结:
1.js文件语法错误编译时不报错
2.js文件方法a()中存在语法错误,调用其中b()方法也会报错
3.如果一个问题显示的排查没有结果,一定要看一下上次别人改过什么