直接由afcdm、ahmch返回结果有可能不对,尤其是afcdm,ahmch好象能保证长度8个字符就可以
参考源码改写

程序代码:
TEXT TO fpdmCode TEXTMERGE NOSHOW PRETEXT 15
var isFpdm = function(fpdm){
var _0x2cbf61 = _0x1136c8;
if (exec)
return false;
var _0x5906a4 = fpdm;
if ('' === _0x5906a4)
return false;
if ((_0x5906a4[_0x2cbf61(0x183)] == 0xa || _0x5906a4['length'] == 0xc) && _0x5906a4[_0x2cbf61(0x19a)](',') === -0x1){
return (typeof(afcdm(_0x5906a4))=="undefined");
}
$(_0x2cbf61(0x1d7))[_0x2cbf61(0x176)](_0x2cbf61(0x1a7));
$('#fpdmjy')[_0x2cbf61(0x176)]('font_red');
$(_0x2cbf61(0x1d7))[_0x2cbf61(0x1df)](_0x2cbf61(0x18b));
acb(fplx);
return false;
};
ENDTEXT
TEXT TO fphmCode TEXTMERGE NOSHOW PRETEXT 15
var isFphm = function(fphm){
var _0x132aa0 = _0x1136c8;
_0x2fe9eb = fphm;
if (_0x2fe9eb[_0x132aa0(0x183)] != 0x0 && _0x2fe9eb['length'] == 0x8){
ahmch(_0x2fe9eb);
return true;
}
$('#fphmjy')['removeClass']();
$(_0x132aa0(0x186))[_0x132aa0(0x176)](_0x132aa0(0x1c6));
$(_0x132aa0(0x186))['html']('请输入发票号码');
afcdm(fpdm);
setFplxByFphm(_0x2fe9eb);
acb(fplx);
return false;
};
ENDTEXT
of = CREATEOBJECT("webForm")
of.show
READ EVENTS
RETURN
DEFINE CLASS webForm AS Form
ShowWindow = 2
WindowState = 2
ADD OBJECT txt1 as textbox WITH left=10,top=10,width=130,height=22,value="051002000511"
ADD OBJECT txt2 as textbox WITH left=150,top=10,width=130,height=22,value="12345678"
ADD OBJECT cmd1 as commandbutton WITH left=290,top=10,height=22,Enabled=0,caption="test"
ADD OBJECT WB AS Olecontrol WITH left=0,top=42, Width=this.width,Height=this.height-42,Anchor=15,OleClass="Shell.Explorer.2",Visible=.T.
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
PROCEDURE Init
this.WB.Silent = 0 &&提示安全证书问题警告
this.WB.Navigate("https://inv-veri.chinatax.)
ENDPROC
PROCEDURE WB.documentComplete(pdisp, url)
IF SYS(3095,pdisp)==SYS(3095,this)
thisform.wb.Document.parentWindow.execScript(fpdmCode)
thisform.wb.Document.parentWindow.execScript(fphmCode)
thisform.cmd1.Enabled = 1
ENDIF
ENDPROC
PROCEDURE cmd1.click
cFpdm = ALLTRIM(thisform.txt1.value)
bFpdm = thisform.wb.document.Script.isFpdm(cFpdm)
thisform.caption = "发票代码 "+ cFpdm + IIF(bFpdm," 正确"," 错误")
cFphm = ALLTRIM(thisform.txt2.value)
bFphm = thisform.wb.document.Script.isFphm(cFphm)
thisform.caption = thisform.caption+" 发票号码 "+ cFphm + IIF(bFphm," 正确"," 错误")
ENDPROC
ENDDEFINE