前几天一网友向本人提出了如题所说的一个问题: PB11的webform发布成的数据窗口分页浏览时,如果单击“前页/后页”后,又马上快速单击“后页/前页”文字按钮,网页会报告一个JS错误:
后来本人经分析发现,该问题出现在PB11的一个名为dwcommon.js文件中,原始位置在:
X:\Program Files\Sybase\PowerBuilder 11.X\DotNET\webroot\scripts下,焦点在如下函数中:
function HTDW_performAction(action)
{
this.action = action;
if(action.substr(0,7) == "DDDWCB|")
{
this.dddwcallback( HTDW_dddwCallbackHandler, action );
return;
}
if ((this.pagingMode == DW_PAGING_XMLCLIENTSIDE) &&
(action == "PageNext" ||
action == "PagePrior" ||
action == "PageFirst" ||
action == "PageLast"))
{
this.xmlRenderer.transformClientSidePage( action );
}
else if (this.pagingMode == DW_PAGING_XMLCLIENTSIDE &&
action == "InsertRow")
{
this.xmlRenderer.insertClientSide( );
}
else if (this.pagingMode == DW_PAGING_XMLCLIENTSIDE &&
action == "AppendRow")
{
this.actionRow = this.rows.length;
this.xmlRenderer.insertClientSide( );
}
else if (this.pagingMode == DW_PAGING_XMLCLIENTSIDE &&
action == "DeleteRow")
{
this.xmlRenderer.deleteClientSide( );
}
else if (this.b4GLWeb)
{
var tempType;
tempType = eval('typeof goWindowManager');
if(tempType == "object")
{
if((this.bIsButtonPress + "" != "undefined") && this.bIsButtonPress )
{
this.submit();
return;
}
}
if ((this.pagingMode == DW_PAGING_CALLBACK) && (this.callback + "" != "undefined") )
this.callback( HTDW_callbackHandler, action );
else
// cause the surrounding page to be submitted
if (this.submit + "" != "undefined") //Asp.Net
this.submit();
else
psPage.Submit(); //Jsp Target
}
else // deal with it like in 7.0
{
var rc = 0;
// OnSubmit can prevent the page from being submitted by returning 1
if (this.eventImplemented("OnSubmit"))
{
if(this.autoEventBind)
rc = _evtDefault(this.OnSubmit ());
else
rc = _evtDefault(this.OnSubmit (this));
}
if (rc == 0)
{
this.actionField.value = this.action;
this.contextField.value = this.GetFullContext();
this.submitForm.submit();
}
}
}
我们观察红色标注的几行,其中: psPage.Submit(); //Jsp Target 按说明应是用于jsp网页的,照理在asp.net下不应该运行到这里,可实际跟踪发现,如果用户是按上述所示操作前翻后翻的话,this.submit = "undefined",所以就执行到 psPage.Submit(); 了,这样自然就会出现对象未定义的错误。
修改: 只要直接屏蔽该条语句即可
.
.
.
else
psPage.Submit(); //Jsp Target
||
||
V
else
{
//psPage.Submit(); //Jsp Target
}
阅读(2596) | 评论(1) | 转发(0) |