也可以用页面Document接口取数
程序代码:
oie = CREATEOBJECT("internetexplorer.application")
oie.Navigate("http://data./yjfp/detail/000001.html")
DO WHILE oie.Busy OR oie.ReadyState!=4
DOEVENTS
INKEY(1)
?? " 请稍候......",TIME()+0h0D
ENDDO
bError = .F.
TRY
oTab = oie.Document.getElementsByTagName("tbody").[1]
CATCH
bError = .T.
ENDTRY
IF !bError
CREATE CURSOR tt (;
f1 C(10),f2 C(10),f3 C(12),f4 C(10),f5 C(10),f6 C(10),;
f7 N(6,2) NULL,f8 N(6,2) NULL,f9 N(6,2) NULL,f10 N(6,2) NULL,;
f11 N(6,2) NULL,f12 N(6,2) NULL,f13 N(6,2) NULL,;
f14 C(6),f15 C(6),f16 C(6),f17 C(8),f18 C(6))
FOR EACH oRow IN oTab.Rows
INSERT INTO tt VALUES (;
oRow.cells(0).innertext,;
oRow.cells(1).innertext,;
oRow.cells(2).innertext,;
oRow.cells(3).innertext,;
oRow.cells(4).innertext,;
oRow.cells(5).innertext,;
IIF(oRow.cells( 6).innertext!="-", VAL(oRow.cells( 6).innertext), NULL),;
IIF(oRow.cells( 7).innertext!="-", VAL(oRow.cells( 7).innertext), NULL),;
IIF(oRow.cells( 8).innertext!="-", VAL(oRow.cells( 8).innertext), NULL),;
IIF(oRow.cells( 9).innertext!="-", VAL(oRow.cells( 9).innertext), NULL),;
IIF(oRow.cells(10).innertext!="-", VAL(oRow.cells(10).innertext), NULL),;
IIF(oRow.cells(11).innertext!="-", VAL(oRow.cells(11).innertext), NULL),;
IIF(oRow.cells(12).innertext!="-", VAL(oRow.cells(12).innertext), NULL),;
oRow.cells(13).innertext,;
oRow.cells(14).innertext,;
oRow.cells(15).innertext,;
oRow.cells(16).innertext,;
oRow.cells(17).innertext)
ENDFOR
SELECT * FROM tt
ELSE
? " Error"
ENDIF
oie.Quit()
RETURN