如何调用网站的时间? 我想调用这个网站的时间:http://bjtime.cn/这个网站是北京时间的。我想调用它。例如:当那个网站的时间为2009年3月30号 19:00:00时我程序里的checkbox1属性为false 那么该如何写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个网站的[现在时间]是取自你本机当前系统时间的。在页面代码里并没有返回任何时间,除非你安装它的ActiveX控件。 刚刚搞定一个和你一模一样的问题而这个问题是我昨天正好刚研究过的unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, SHDocVw,mshtml;type TForm1 = class(TForm) WebBrowser1: TWebBrowser; Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); procedure WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);beginWebBrowser1.Navigate('http://s.time.org.cn/clock/'); //打开地址end;procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant);beginedit1.Text:=IHtmlDocument2(WebBrowser1.Document).Body.Outertext;end;end.-----------------------object Form1: TForm1 Left = 409 Top = 176 Width = 424 Height = 364 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object WebBrowser1: TWebBrowser Left = 32 Top = 16 Width = 300 Height = 150 TabOrder = 0 OnDocumentComplete = WebBrowser1DocumentComplete ControlData = { 4C000000021F0000810F00000000000000000000000000000000000000000000 000000004C000000000000000000000001000000E0D057007335CF11AE690800 2B2E126208000000000000004C0000000114020000000000C000000000000046 8000000000000000000000000000000000000000000000000000000000000000 00000000000000000100000000000000000000000000000000000000} end object Button1: TButton Left = 80 Top = 184 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 1 OnClick = Button1Click end object Edit1: TEdit Left = 48 Top = 224 Width = 169 Height = 21 TabOrder = 2 Text = 'Edit1' endend 你只要对edit1里取到的时间做判断即可 向[僵哥]道歉 TreeView如何在程序运行中添加类容,比如父节点,子节点,删除节点等? 查询中有关多线程显示的问题,急!!!! MDI窗体的问题,子窗体怎么不能控制父窗体菜单的属性呢? Report machine3.0制作主从表报表 clientdataset求助?(高分) TStringGrid 如何合并选中的单元格? delphi 运行的问题,intenal error pro-2688(求助) 在网页上取数据到数据库 CreateOleObject的时候出错,错误内容为尚未调用CoInitialize. 如何调用网站的时间? 结构树问题,急!!
而这个问题是我昨天正好刚研究过的
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw,mshtml;type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('http://s.time.org.cn/clock/'); //打开地址
end;procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
edit1.Text:=IHtmlDocument2(WebBrowser1.Document).Body.Outertext;end;end.
-----------------------
object Form1: TForm1
Left = 409
Top = 176
Width = 424
Height = 364
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object WebBrowser1: TWebBrowser
Left = 32
Top = 16
Width = 300
Height = 150
TabOrder = 0
OnDocumentComplete = WebBrowser1DocumentComplete
ControlData = {
4C000000021F0000810F00000000000000000000000000000000000000000000
000000004C000000000000000000000001000000E0D057007335CF11AE690800
2B2E126208000000000000004C0000000114020000000000C000000000000046
8000000000000000000000000000000000000000000000000000000000000000
00000000000000000100000000000000000000000000000000000000}
end
object Button1: TButton
Left = 80
Top = 184
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object Edit1: TEdit
Left = 48
Top = 224
Width = 169
Height = 21
TabOrder = 2
Text = 'Edit1'
end
end