在一个form中使用webbrowser控件显示某个test.asp文件
test.asp为框架结构,分成若干个frame,其中frame1显示test1.asp
在test1.asp中,有两个图片链接
图片1对应的ASP代码为
<A href="#" onmousedown=go()><IMG alt=pic1 border=0 height=21 src="images/1.gif" width=20></A>
图片2对应的ASP代码为
<A href="#" onmousedown=to()><IMG alt=pic2 border=0 height=21 src="images/2.gif"
width=20></A>现在的问题是:如何用VB代码模拟点击两个图片链接?(所有ASP页面代码不可更改)
比如用两个timer,分别以5秒为周期自动模拟点击图片1和2的链接
(我是指可在后台运行,不影响其他程序操作)麻烦给出相对完整的代码,测试有效就给50分
谢谢
test.asp为框架结构,分成若干个frame,其中frame1显示test1.asp
在test1.asp中,有两个图片链接
图片1对应的ASP代码为
<A href="#" onmousedown=go()><IMG alt=pic1 border=0 height=21 src="images/1.gif" width=20></A>
图片2对应的ASP代码为
<A href="#" onmousedown=to()><IMG alt=pic2 border=0 height=21 src="images/2.gif"
width=20></A>现在的问题是:如何用VB代码模拟点击两个图片链接?(所有ASP页面代码不可更改)
比如用两个timer,分别以5秒为周期自动模拟点击图片1和2的链接
(我是指可在后台运行,不影响其他程序操作)麻烦给出相对完整的代码,测试有效就给50分
谢谢
ttt(0).clickttt(1).click
把这个加到timer控件就可以了
这样得到的是test.asp里tagname="a"的对象
但实际上,我要点的图片在test1.asp里,test1.asp又在frame里
如果列出test.asp里的对象,只能列出test1所在的frame,不能列出frame里的元素
放2个timer
Private Sub Timer1_Timer()
WebBrowser1.Navigate "file:/d:/"
Timer1.Enabled = False
Timer2.Enabled = True
Timer1.Interval = 5000
End SubPrivate Sub Timer2_Timer()
Timer2.Interval = 5000
WebBrowser1.Navigate "file:/c:/"
Timer2.Enabled = False
Timer1.Enabled = True
End Sub
处就可以了
ttt(0).clickttt(1).click
把这个加到timer控件就可以了
没仔细看命题
但是新问题出来了<A onmousedown=go() href="http://www.test.com/test.asp#"><IMG height=21
alt=pic1 src="ice.files/1.gif" width=20 border=0></A>
<A onmousedown=to() href="http://www.test.com/test.asp#"><IMG height=21
alt=pic2 src="ice.files/2.gif" width=20 border=0></A>
这是两个图片文件的ASP代码我用
WebBrowser.Document.frames(1).Document.All(11).Click
WebBrowser.Document.frames(1).Document.All(13).Click
(tagname="A"的对象)
或者
WebBrowser.Document.frames(1).Document.All(10).Click
WebBrowser.Document.frames(1).Document.All(12).Click
(tagname="IMG"的对象)
都不能模拟两个图片的鼠标点击,也没有出错提示
问题在哪里?
(对象引用肯定是正确的)哪位高人解答一下?
ttt.href="www.msdn.com"
ttt.id="bbb"
set nnn=webbrowser1.document.getElementsByTagName(body)
nnn(0).appendchild ttt
set uuu=webbrowser1.document.getElementById("bbb")
uuu.click