0

试图在输出中并排显示 2 个将由bAddItem()添加的项目。我尝试使用 HTML 标签但未能成功,我也使用在 response.write() 中编写 HTML 标签但失败了,任何人都可以建议如何在输出中并排显示文本和复选框

<%  
for iCount = 0 to UBound(aPhoneTypeId,2) - 1
dim Consentindarray
dim Checkedstatus
dim consentvalue
Consentindarray=""
Checkedstatus=0
Consentindarray = split(TrimValue(oRstInd("user48")),",") 
for each consentvalue in Consentindarray
   if InStr(1, consentvalue, trim(aPhoneTypeId(0,iCount)) ) > 0 then
        Checkedstatus=1              
   end if
next
if Len(trim(aPhone(iCount))) > 0 then
   if aPhoneTypeId(0,icount) = sPhoneType then 
       **if bSuccess then bSuccess = bAddItem(oSectionNode, "text", aPhoneTypeId(1,icount), aPhone(iCount), "", true)**  end if

       **if bSuccess then bSuccess = bAddItem(oSectionNode, "checkbox","",Checkedstatus, "", false)** end if

   else 
     if bSuccess then bSuccess = bAddItem(oSectionNode, "text", aPhoneTypeId(1,icount), aPhone(iCount), "", false) end if

     if bSuccess then bSuccess = bAddItem(oSectionNode, "checkbox","",Checkedstatus, "", false) end if

   end if
  end if
next 
4

1 回答 1

1

输出表格的方式与输出任何其他 html 的方式相同:使用Response.Write语句,或者关闭脚本,%>然后编写实际的 html。

 <html>
 <head><title>This is my page</title>
 <%
 dim V, N, i
 %>
 </head>
 <body>
 <table><tr><th>Name</th><th>Age</th></tr>
 <%
 ' ... (code to load data into V() goes here)
 ' ...
 If N = 0 Then 
    Response.Write "<tr><td colspan='2'>No data found</td></tr>"
 Else
    For i = 0 to N-1
       Response.Write "<tr><td>" & V(0,i) & "</td><td>" & V(1,i) & "</td></tr>"
    Next
 End If
 %>
 </table>
 </body>
 </html>

我对引用的值采取了“简单的方法”:我只是使用了单引号,因为 html 不关心任何一种方式。如果您必须使用双引号,您可以选择双引号 ( "<td colspan=""2"">") 或使用字符代码: ( "<td colspan=" & Chr(34) & "2" & Chr(34) & ">")。

 

也就是说,看起来你输出的不是任何表格。据我所知,您似乎正在尝试写出一个复选框和一个标签。其机制并没有什么不同。您只需要使用适当的 html 标签。(但有一件事:首先有复选框,然后是标签几乎总是更好 - 这是大多数人习惯的,如果你有一个复选框列表,它们会以这种方式更好地对齐。)

...
<form method="post" action="FormName.asp">
<input type="hidden" name="Option1" value="<%=Opt1%>">
<%
For f = 1 to iCount
   Response.Write "<p><label><input type='checkbox'"
   Response.Write " value='" & aPhoneTypeId(0,f) & "'"
   Response.Write " name='PhoneType_" & f & "'"
   If aPhoneTypeId(0,f) = sPhoneType Then Response.Write " checked"
   Response.Write ">" & aPhoneTypeId(1,f) & "</label></p>"
Next
%>
</form>
...

(请注意,我不知道你的变量实际上包含什么,所以上面的内容可能完全是胡言乱语,但它应该给你一个关于如何开始的提示。)

于 2013-11-05T01:49:23.100 回答