在页面中,有用javascript脚本生成的array  :
<SCRIPT language=JavaScript>
var Game=new Array();
Game[0]=new Array('1','2','3');我用WebBrowser1.OleObject.document.Game.length能得到array长度,但如果写WebBrowser1.OleObject.document.Game[0][1] 就出错,但写WebBrowser1.OleObject.document.Game可以返回整个数组,我该如何指定访问数组中的某个元素呢 ??

解决方案 »

  1.   

    我也是困绕这个问题,我有一个笨的办法,就是使用execwb,全不选择,然后拷贝,然后分析,这个方法倒是简单,就是焦点不知道怎么自动的对到那个网页
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
    doc:IHTMLDocument2;
    begin
    doc := WebBrowser1.Document as IHTMLDocument2;
    memo1.text:=doc.body.innerHTML ;
    NavigateFrameset(doc) ;
    end;procedure TForm1.NavigateFrameset(document: IHTMLDocument2);
    var
        index: Integer;
        ole_index: OleVariant;
        frame_dispatch: IDispatch;
        framed: IHTMLWindow2;
    begin
        if document = nil then
            exit;
        try
            Application.MessageBox(
                PChar('Content:' + String(document.body.innerHTML)),
                PChar('URL: ' + String(document.URL)),MB_OK or
                MB_ICONINFORMATION);
            for index := 1 to document.Frames.Length do
            try
                ole_index := index-1;
                frame_dispatch := document.Frames.Item(ole_index);
                if frame_dispatch <> nil then
                begin
                    framed := frame_dispatch as IHTMLWindow2;
                    NavigateFrameset(framed.document);
                end;
            except
                on E: Exception do
                begin
                end
            end;
        except
            on E: Exception do
                begin
                    Application.MessageBox(PChar(E.Message),
                    PChar('Exception'));
                end;
        end;
    end;
    import the "Microsoft HTML Object Library" (MSHTML.TLB) and include MSHTML_TLB in the unit's uses clause
    这个问题困扰我很长时间,今天彻底解决了,希望和大家共享,绝对通过了,别怕麻烦,你拷贝过去,试验一下
    可以显示所有frame