高分向高手求救!关于回车跳焦点的问题!
项目中需要输入code,按回车自动提交页面。本人做的函数如下:
调用如下:
可以正常运行。
现在客户要求在输入完code以后,能够给出提示音,类似消息框的报警音。
于是本人又做函数如下:
然后在对应的控件中追加上面这个方法:
当输入完code焦点离开时,确实发出了提示音,但是当暗回车提交页面时,出现错误如下:
错误: uncaught exception: [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: chrome://global/content/bindings/autocomplete.xml :: onxblpopuphiding :: line 834" data: no]
望高手指点,高分求解。
function testEnterToTab(event,flg) {
var e = event?event:window.event;
if(e.keyCode == 13){
if ('s' == flg) {
doSearchS_Barcode();//提交相关函数
} else if ('b' == flg) {
doSearchB_Barcode();//提交页面相关函数
}
}
}
调用如下:
<html:text name="CollectionLendForm" styleId="s_barcode" property="s_barcode" size="18" maxlength="32" style="width:200px;" onkeydown="testEnterToTab(event, 's');" tabindex="1"/>
可以正常运行。
现在客户要求在输入完code以后,能够给出提示音,类似消息框的报警音。
于是本人又做函数如下:
function tospeakSound() {
var sLen = <%= sLen %>;
var sbarcode = document.forms[0].s_barcode;
if (sbarcode.value.Trim().length == sLen) {
document.getElementsByTagName("bgsound")[0].src = '<%= ctxtPath %>/images/music/ding.wav';
}
}
然后在对应的控件中追加上面这个方法:
<html:text name="CollectionLendForm" styleId="s_barcode" property="s_barcode" size="18" maxlength="32" style="width:200px;" onkeydown="testEnterToTab(event, 's');" onchange="tospeakSound();" tabindex="1"/>
当输入完code焦点离开时,确实发出了提示音,但是当暗回车提交页面时,出现错误如下:
错误: uncaught exception: [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: chrome://global/content/bindings/autocomplete.xml :: onxblpopuphiding :: line 834" data: no]
望高手指点,高分求解。
...全文


