在vb脚本中的脚本标记内的表单标记

时间:2015-04-23 22:27:03

标签: html vbscript

我可以将Form标记放在脚本标记中吗?由于以下代码正在运行&给出输出,

<html>
    <head>
    </head>
    <body>
        <h2>Employment Application</h2>
        <form name="frmEmployees">
            <table border="0" width="288">
                <tr>
                    <td width="80">First Name:</td>
                    <td width="194"></td>
                </tr>
                <tr>
                    <td width="80">Last Name:</td>
                    <td width="194"></td>
                </tr>
            </table>
        </form> 
    </body>
</html>

但是当我将此表单标记放在脚本标记内时,它只是不提供任何输出。

<html>
    <head>
    </head>
    <body>
        <script type = "text/vbscript">
            <h2>Employment Application</h2>
            <form name="frmEmployees">
                <table border="0" width="288">
                    <tr>
                        <td width="80">First Name:</td>
                        <td width="194"></td>
                    </tr>
                    <tr>
                        <td width="80">Last Name:</td>
                        <td width="194"></td>
                    </tr>
                </table>
            </form>
        </script>
    </body>
</html>

1 个答案:

答案 0 :(得分:1)

实际上你不能将"<tag>"放在vbscript代码中,否则它只会给你一个未知命令行的错误。我认为有一种方法可以使用vbs代码设置它,但是你发布的方式不起作用

编辑:如果你要查找的是从vbs脚本添加或编辑它,那么你应该从脚本表单中声明它然后从vbs编辑它{你可能使其不可见,然后从脚本中的代码更改它:

<Script type="VBScript">
  sub button1_onclick    ' assuming that you have a button1
    frmemployees.width = 300 'to change the width
    frmemployees.height = 300 ' to change the height 
    frmemployees.InnerHTML = "String here" ' to edit the code inside of it
    ' for example to put the code you have in your example into the form do this :
    frmemployees.InnerHTML = " <table border=""0"" width=""288"">" & vblf & _
    "<tr>" & vblf & "<td width=""80"">First Name:</td>" & vblf & _
    "<td width=""194""></td>" & vblf & "</tr>" & vblf & "<tr>" & vblf & _
    "<td width=""80"">Last Name:</td>" & vblf & "<td width=""194""></td>" & vblf & _
    "</tr>" & vblf & "</table>"
    'this should be it :D 
  end sub
</script>

也没有.width,.height和.InnerHTML,你可以google它,你可以找到一堆你可以使用vbs代码设置的参数,希望这就是你&#39 之后