【问题标题】:How to create a sub function with html code?如何使用 html 代码创建子函数?
【发布时间】:2021-04-13 21:31:15
【问题描述】:

我正在尝试在经典 asp 中创建一个显示密码的子函数:文本空间?有什么建议吗?

Sub GetPassword()
   response.write " Password:"
   <input type="text" name="txtEmPwd" size="20" value="<%=strEmPwd%>">&nbsp;&nbsp;1st 3 chars of 
   last name&nbsp;<input type="text" name="txtFirst3" size="5" maxlength=3 value="<%=strFirst3%>"> 
end sub

我在大于字符的地方得到一个错误

Microsoft VBScript 编译错误'800a0400'

预期声明

【问题讨论】:

标签: html asp-classic


【解决方案1】:

那是因为您直接在服务器端代码中编写 html。 您必须将 html 添加为字符串,如下所示:

Sub GetPassword()
   dim html
   html = "Password:"
   html = html & "<input type='text' name='txtEmPwd' size='20' value='" & strEmPwd & "'>&nbsp;&nbsp;1st 3 chars of last name&nbsp;"
   html = html & "<input type='text' name='txtFirst3' size='5' maxlength='3' value='" & strFirst3 & "'>"
   Response.Write html
end sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-14
    • 1970-01-01
    • 2016-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多