【发布时间】:2021-02-11 23:41:17
【问题描述】:
我希望将我的下拉列表和单选按钮设为只读,以便它可以接收输入。我不希望它被禁用。
下拉列表...
<select name="ctitle" readonly>
<option selected value=" "> </option>
<%do until rsPositions.eof
strContent = rsPositions("descrip")
StrValue = rtrim(rsPositions("descrip"))
intThisId = rsPositions("id")
if ucase(rtrim(strCtitle)) = ucase(strValue) then%>
<option selected value="<%=strValue%>"><%=StrContent%></option>
<%else
if not StrReadOnly then%>
<option value="<%=strValue%>"><%=StrContent%></option>
<%end if
end if
rsPositions.movenext
loop%>
</select>
单选按钮...
<%if StrCurtype="H" then%>
<input type="radio" name="curtype" value="H" checked >
<% else%>
<input type="radio" name="curtype" value="H">
<% end if%>Hourly
<% if StrCurtype="S" then%>
<input type="radio" name="curtype" value="S" checked >
<% else%>
<input type="radio" name="curtype" value="S" >
<% end if%>
Salary(<%=StrPayCycleDes%>)
【问题讨论】:
-
您究竟何时希望将下拉列表和单选按钮设为只读?这是:a) 在页面回传到服务器之后,还是 b) 用户选择了一个值?
-
页面发布后,当我打开页面时,当前部分应该是只读的。
-
当您询问 HTML UI 元素时,您使用的是 Classic ASP 的事实与此问题无关。如果您只显示呈现的 HTML 而不是包含经典 ASP 代码会更好,因为它只会混淆您希望解决的问题。
-
@Lankymart - 是也不是 - OP 可以使用 JavaScript 来实现其目的(因为他们已经使用了标志)。 answer below 提供了有关操作方法的想法,但 OP 需要眼镜!
-
...不过linked answer by Sampson 更好。
标签: javascript html asp-classic