作者:mobiledu2502877091 | 来源:互联网 | 2023-05-18 22:20
ImlookingtouseaVBScriptvariablewithinareferencetoaDOMelementforaweb-appImbuildin
I'm looking to use a Vbscript variable within a reference to a DOM element for a web-app I'm building. Here's a brief excerpt of the affected area of code:
我正在寻找在我正在构建的Web应用程序的DOM元素的引用中使用Vbscript变量。以下是受影响的代码区域的简短摘录:
dim num
num = CInt(document.myform.i.value)
dim x
x = 0
dim orders(num)
For x = 0 To num
orders(x) = document.getElementById("order" & x).value
objFile.writeLine(orders(x))
Next
This is my first venture into Vbscript, and I've not been able to find any methods of performing this type of action online. As you can see in the above code, I'm trying to create an array (orders). This array can have any number of values, but that number will be specified in document.myform.i.value
. So the For loop cycles through all text inputs with an ID of order+x (ie, order0, order1, order2, order3, order4, etc. up to num)
这是我第一次进入Vbscript,我无法找到任何在线执行此类操作的方法。正如您在上面的代码中看到的,我正在尝试创建一个数组(orders)。此数组可以包含任意数量的值,但该数字将在document.myform.i.value中指定。所以For循环遍历所有文本输入,ID为order + x(即order0,order1,order2,order3,order4等,最多为num)
It seems to be a problem with my orders(x) line, I don't think it recognizes what I mean by getElementById("order" & x)
, and I'm not sure exactly how to do such a thing. Anyone have any suggestions? It would be much appreciated!
这似乎是我的订单(x)行的一个问题,我认为它不能识别我的意思getElementById(“order”&x),我不确定如何做这样的事情。有人有什么建议吗?非常感谢!
4 个解决方案