response.write中的问题转义引号

时间:2011-05-06 07:44:32

标签: vbscript asp-classic

嘿朋友请帮帮我... 我怎么能写response.write语句.....我想放置单选按钮但是response.write中的某些问题是从记录集RSORS中获取字符串...

set ORS = Server.CreateObject("ADODB.recordset")
getopt="SELECT * FROM Options WHERE QuestionID=" & RS("QuestionID")
ORS.Open getopt,Conn

if not ORS.EOF then
    ORS.movefirst
    do
        response.write " <input type='radio' name=' 'Question' & RS('QuestionID')& ''' value='Answer' & ORS('OptionID') & ''' > <h2 >" & ORS("Option") & "</h2><br />"
        ORS.movenext
    loop until ORS.EOF
end if

RS.movenext
loop until RS.EOF

2 个答案:

答案 0 :(得分:1)

使用双引号"分隔服务器端字符串,并使用单引号'为客户端:

response.write " <input type='radio' name='Question" & RS("QuestionID") & "' value='Answer" & ORS("OptionID") & "'> <h2>" & ORS("Option") & "</h2><br />"

答案 1 :(得分:0)

有时最好将长字符串分解为更小,更易于管理的字符串。试试 -

response.write "<input type='radio' name='Question"
response.write RS("QuestionID") & "' value='Answer"
response.write ORS("OptionID") & "'> "
response.write "<h2>" & ORS("Option") & "</h2><br />"