使用vba触发html anchor href =“javascript:void(0)” [英] Use vba to trigger html anchor href="javascript:void(0)"

查看:152
本文介绍了使用vba触发html anchor href =“javascript:void(0)”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图用excel vba来访问这个网站获取其数据。我可以得到这些数据,我可以更改日期,我的问题是改变时间(例如00:00 - 01:00到01:00 - 02:00)。我想这是由于

 < a href =javascript:void(0)class =select2-choice tabindex = -  1> 

元素后面。
我只是不明白如何传递新的时间跨度以及如何触发它来更改数据。我已经在锚元素上尝试过FireEvents(onclick),但没有成功。



我希望有人能帮助我。谢谢!

解决方案

我已经设法通过使用

更改网站元素上显示的时间

 设置myData10 = IE.document.getElementsByTagName(span)
对于每个inputElement在myData10中
如果inputElement.ID =select2 -chosen-3Then
Set timepicker = inputElement
timepicker.Focus
timepicker.innerText =02:00 - 03:00
End If
Next

但好像新时间仍然未被网站处理。网站上的数据并没有改变到新的时间。


This is my first post ever, so I hope not to bore you.

I am trying to use excel vba to access this website to get its data. I can get the data and I can change the dates, my problem is to change the times (e.g. 00:00 - 01:00 to 01:00 - 02:00). I guess this is due to the

<a href="javascript:void(0)" class="select2-choice" tabindex="-1">

behind the element. I just don't understand how to pass on the new time-span and how to trigger it to change the data. I already tried "FireEvents ("onclick")" on the anchor element without success.

I hope anybody can help me. Thank you!!

解决方案

I already managed to change the time shown on the website element by using

Set myData10 = IE.document.getElementsByTagName("span")
For Each inputElement In myData10
    If inputElement.ID = "select2-chosen-3" Then
        Set timepicker = inputElement
        timepicker.Focus
        timepicker.innerText = "02:00 - 03:00"
     End If
Next

but it seems like the new time is still not processed by the website. The data on the website did not change to the new time.

这篇关于使用vba触发html anchor href =“javascript:void(0)”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆