![](/img/trans.png)
[英]Downloading files; Executing a JavaScript function using .execScript VBA
[英]How to pass a parameter to a jquery/javascript function using execScript
我有以下代碼來選擇kendoDropDownList中的第一項。 通過將select中的參數從1更改為2,我可以選擇第二項。 有沒有一種方法可以將參數(例如1或2或3等)傳遞到此行?
ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(1));"
我已經嘗試通過使用雙引號,單引號,無引號設置名為xp的變量來嘗試以下操作,但是除非在dropDownList中實際上是許多有效項,否則什么也不會發生。
ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(""xp""));"
斯萊給了我正確答案。 該行發布在下面。
設置xp變量,它已正確傳遞
ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(" & xp & "));"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.