html - 使用 Excel VBA 将值传递给网站中的文本框
问题描述
我正在尝试浏览网站并根据 Excel 的输入执行活动。
我坚持将值传递给输入元素,该元素根据我们传递的值在下一个文本框中自动填充值(例如:如果我在目标框中传递邮政编码,则城市名称会自动填充在下一个框中)。我可以传递值,但它不会触发自动填充值的 JS。
网页中的目标框代码
<input name="zipcode" class="inputBoxRequired" id="zipcode" onkeypress="return isNumberKey(event)" onblur="getZipCity(this.value,'/ProviderPortal')" type="text" size="46" maxlength="5">
代码尝试
Set Zip = ie_Doc.getElementById("zipcode")
Zip.Value = Zip_Code 'Here value gets updated but associated js is not triggered
ie_Doc.getElementById("zipcode").Focus
甚至尝试过火灾事件
Zip.FireEvent ("onchange")
在网页中,它被称为 Onkeypress 事件。我用谷歌搜索找到解决方案,但我无法得到确切的解决方案。
解决方案
Zip.FireEvent ("onkeypress")
Zip.FireEvent ("onblur") '<== Apparently this did the trick
这些是显示的事件。
推荐阅读
- oracle - 如何执行立即执行语句的输出结果
- powerbi - 如何在 Power BI 中动态获取列名?
- python - 在 python 中究竟意味着什么:False==(False or True) is False?
- android - 无法将我的图像上传到 android studio 中的 firebase
- oracle - max(row_num) 给我的结果与 oracle 中的 count(*) 不同。这是我的查询
- r - 进行主成分分析时出错
- jdbc - JMeter - 在 JDBC 请求中检索百万条记录时出现 OutOfMemoryError
- mongodb - 无法下载 mongodb 依赖项
- mysql - 如何从 MySQL 数据库中选择特定记录
- react-native - 反应映射依赖问题