0

对您来说可能是一个简单的专家,我正在尝试使用 vbscript 进行屏幕抓取,但是我尝试将数据放入其中以便在此站点上运行表单的文档元素中包含符号,并且 VBscripting 在标识符上出错.. .

With IE.Document.aspnetForm
    .l00$_SUMMARY$txtIP.value = server_ip
    .submit
End With

这是网页中该元素的视图源

<input name="ctl00$_SUMMARY$txtIP" type="text" id="ctl00_SUMMARY_txtIP" style="width:100px;" />

谢谢大家,

吉姆

4

1 回答 1

0

这个演示 .HTA 展示了三种(二十九种)通往我宝宝门的方式:

<html>
 <head>
  <hta:application id="demo square brackets" scroll="No"></hta>
  <title>Demo</title>
  <script language = "VBScript"
          type     = "text/vbscript"
  >
  Sub onLoad()
    MsgBox "A " & document.all.[ctl00$_SUMMARY$txtIP].value
    MsgBox "B " & document.getElementById("ctl00$_SUMMARY$txtIP").value
    MsgBox "C " & document.getElementById("ctl00_SUMMARY_txtIP").value
  End Sub
  </script>
 </head>
 <body onload="onLoad">
  <input name="ctl00$_SUMMARY$txtIP" type="text" id="ctl00_SUMMARY_txtIP" value="my baby's door" />
 </body>
</html>

[] 通常可以在 VBScript 中用于向引擎提供带有有趣字母或空格的标识符;getElementById 将 name 和 id 属性考虑在内。

于 2012-09-04T17:11:43.117 回答