无法获取由服务器注册的值

我正在尝试在Excel中创build一个名为SpectrumLive的共享交易网站的VBA界面。

我可以在网站上填写相关表格中购买的股票数量。 但是,当我点击“下订单”button时,它会记住我input的上一个手动值,而不是VBAinput的值。 这就像我需要提出一个事件或类似的东西,让服务器端注册的价值。

该字段看起来像带有可编辑文本字段的combobox。 您可以通过selectcombobox控件中的小箭头来select预定义的值。 然而,脚本直接将值input到文本字段(就像我也可以手动执行)。

我一直在研究这个问题已经有一段时间了,我已经没有想法了。

我使用的VBA是:

theDocument.getElementsByName(“ordertype”)。Item(i).value =“88”

将股份数量设定为88。

我曾尝试通过以下方式触发OnChange事件:

item(i).FireEvent(“onchange”)

但没有运气。

该页面的特定部分的HTML代码如下所示:

<div id="MenuMgr_WM_view4_widgetbfcca409xc930x42d5x8d00x04a83ed68e5f_ordertab_amountrow" class="formrow"> <div id="MenuMgr_WM_view4_widgetbfcca409xc930x42d5x8d00x04a83ed68e5f_ordertab_amountrow_error" class="error_field"> <span class="inline amount"> <label class="label" title="Quantity">Quantity:</label> <div class="amount_type input selector" style="display:none;" name="MenuMgr$WM_view4$widgetbfcca409xc930x42d5x8d00x04a83ed68e5f$ordertab$amountrow$ctl00"> <span id="MenuMgr_WM_view4_widgetbfcca409xc930x42d5x8d00x04a83ed68e5f_ordertab_amountrow_amount" name="MenuMgr$WM_view4$widgetbfcca409xc930x42d5x8d00x04a83ed68e5f$ordertab$amountrow$amount"> <div id="AmountSelectorContainer"> <span id="MenuMgr_WM_view4_widgetbfcca409xc930x42d5x8d00x04a83ed68e5f_ordertab_amountrow_amount_AmountSelectorControl" name="MenuMgr$WM_view4$widgetbfcca409xc930x42d5x8d00x04a83ed68e5f$ordertab$amountrow$amount$AmountSelectorControl"> <div id="AmountSelectorDropDownList" class="left input selector" name="MenuMgr$WM_view4$widgetbfcca409xc930x42d5x8d00x04a83ed68e5f$ordertab$amountrow$amount$AmountSelectorControl$AmountSelectorDropDownList"> **<input class="inp aright" type="text" value="" name="ordertype" title="">** <div class="btns"> </div> </span> </div> </span> </span> <div class="formrow amount_info" style="display: none;"> </div> 

即使上面的“ordertype”字段中的“value”是“”SpectrumLive显示数量88(我有Firebug显示我哪个字段代表combobox的文本字段)。

任何帮助,这是最感激!

谢谢,

 <input class="inp aright" type="text" value="" name="ordertype" title=""> 

上面的html是一个文本框,并设置它的值,你可以使用下面的代码。

  Set i_Order = theDocument.getElementsByName("ordertype") i_Order.Value = "88" 

要么

  Set i_Amt = theDocument.getelementbyid("AmountSelectorDropDownList") set i_Order = i_Amt.NextSibling '(put a breakpoint here) i_Order.Value = "88" 

(转到立即窗口,把这个文本?i_order.OuterHTML在debugging模式,这将让你知道如果你有ordertype文本框。如果它不工作,你可以尝试这个set i_Order = i_Amt.NextSibling.NextSibling

另外我没有看到任何附加到文本框的JavaScript更改事件不需要使用FireEvent。