经典 asp 无法识别 space 字符
Classic asp not recognizing space character
真的这是一个 2 题 post 但我会总结一下..
- 我无法在 select 语句的选项中识别白色 space。
CSS: select{font-family: monospace;}
这是我的代码:(假设我先写 select)..这是选项
for i = 0 to db-1
response.write "<option"
if i = 0 then
response.write " selected"
end if
response.write " value='"
if db(i,3) = 1 and session("id") <> db(i,4) then
Response.Write "-1"
else
Response.Write db(i,0)
end if
Response.Write "'> "
'Option Text, add ID
dim optionText
optionText = "(" & db(i,0) & ")"
'Make all Id's width equal so the text begins on the same vertical line
'Pad with spaces before text, padding for up to id = 99999
if len(optionText) < 7 then
Do While len(optionText)<7
optionText = optionText & "REPLACE HERE"
Loop
end if
'Option Text, add Detail
optionText = optionText + Trim(db(i,5))
'Text
if len(optionText) > 84 then
Response.write left(optionText,81) & "..."
else
'Pad Text to same length so all "locked" can be padded to the right
if len(optionText) < 84 then
Do While len(optionText)<84
optionText = optionText & "REPLACE HERE"
Loop
end if
Response.Write optionText
end if
'Locked
Response.write " 🔒 admin 🔒"
next
将上面两个地方的 "REPLACE HERE" 替换为
或  
或者只是一个 " "
没有任何影响,页面总是只尊重第一个 space.
在图像的此处,您会看到准确的填充。
- 7 - ( id )
- 84 - 直到 "lock" 符号
的总文本长度
do while 循环没有按照您的预期进行;一旦执行 optionText = optionText & " "
,optionText
的长度超过 7,并退出循环。您需要做的是在字符串中添加 7-len(optionText)
个空格。
您可以使用 for 循环来做到这一点:
if len(optionText) < 7 then
for i=1 to 7-len(optionText)
optionText = optionText & " "
next
end if
真的这是一个 2 题 post 但我会总结一下..
- 我无法在 select 语句的选项中识别白色 space。
CSS: select{font-family: monospace;}
这是我的代码:(假设我先写 select)..这是选项
for i = 0 to db-1
response.write "<option"
if i = 0 then
response.write " selected"
end if
response.write " value='"
if db(i,3) = 1 and session("id") <> db(i,4) then
Response.Write "-1"
else
Response.Write db(i,0)
end if
Response.Write "'> "
'Option Text, add ID
dim optionText
optionText = "(" & db(i,0) & ")"
'Make all Id's width equal so the text begins on the same vertical line
'Pad with spaces before text, padding for up to id = 99999
if len(optionText) < 7 then
Do While len(optionText)<7
optionText = optionText & "REPLACE HERE"
Loop
end if
'Option Text, add Detail
optionText = optionText + Trim(db(i,5))
'Text
if len(optionText) > 84 then
Response.write left(optionText,81) & "..."
else
'Pad Text to same length so all "locked" can be padded to the right
if len(optionText) < 84 then
Do While len(optionText)<84
optionText = optionText & "REPLACE HERE"
Loop
end if
Response.Write optionText
end if
'Locked
Response.write " 🔒 admin 🔒"
next
将上面两个地方的 "REPLACE HERE" 替换为
或  
或者只是一个 " "
没有任何影响,页面总是只尊重第一个 space.
在图像的此处,您会看到准确的填充。
- 7 - ( id )
- 84 - 直到 "lock" 符号 的总文本长度
do while 循环没有按照您的预期进行;一旦执行 optionText = optionText & " "
,optionText
的长度超过 7,并退出循环。您需要做的是在字符串中添加 7-len(optionText)
个空格。
您可以使用 for 循环来做到这一点:
if len(optionText) < 7 then
for i=1 to 7-len(optionText)
optionText = optionText & " "
next
end if