was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

38 Visitors Online


 
...Werte aus einem Javascript herausauslesen?
Autor: Thorsten Sanders
Homepage: http://www.dasbinich.info
[ Tip ausdrucken ]  

Tip Bewertung (9):  
     


// Just add a Webbrowser and two Buttons to the form and insert the following code

procedure TForm1.Button1Click(Sender: TObject);
begin
  
webbrowser1.Navigate('http://www.dasbinich.info/myred/delphi/index.html');
end;

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
begin
  if 
(url = 'http://www.dasbinich.info/myred/delphi/index.html') then
    
ShowMessage('Value lautet: ' + webBrowser1.OleObject.Document.Forms.item
    ('test').Elements.item('testen').Value);
  //read the Javascript value testen of the form test
end;

//this is an example how to use it when there are no names
procedure TForm1.Button2Click(Sender: TObject);
begin
  
ShowMessage('Value lautet: ' + webBrowser1.OleObject.Document.Forms.item
  (0).Elements.item(0).Value);
end;


//to read the javascript value from a site with a frame use the following
webBrowser1.OleObject.Document.Frames.item('top').Document.Forms.item
('Countdown').Elements.item('Countdown').Value;
//top is the framename in this example


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners