无法从变量vbscript执行某些操作

时间:2016-09-14 04:55:34

标签: html vbscript

C:\ highlight2.txt的数据是: “document.all.status1.innerText ='组件故障'”

<script>
    set oFile=oFSO.OpenTextFile("C:\highlight2.txt",1)
       text=oFile.ReadAll
       oFile.Close
       arrLines = Split(text, vbCrLf)
       dim cmds
       For Each strLine in arrLines
       if strLine = "" Then
       else
        strLine
       end if
       next

    </script>

    <input value="component check progress" type="text" id="Status1" >

我需要从文本中更改输入字段,但它不起作用,输入文本ID是可变的。谢谢,帮助我真的很感激。

1 个答案:

答案 0 :(得分:0)

如果您有一个包含要执行的代码的字符串,则需要execute

>> For Each s In Split("WScript.Echo 1|WScript.Echo 2", "|")
>>     WScript.Echo "Statement:", s
>>     Execute s
>>   On Error Resume Next
>>     s
>>     WScript.Echo Err.Description
>>   On Error GoTo 0
>>     WScript.Echo "-----------"
>> Next
>>
Statement: WScript.Echo 1
1
Type mismatch
-----------
Statement: WScript.Echo 2
2
Type mismatch
-----------
>>