禁用属性不起作用

编程入门 行业动态 更新时间:2024-10-19 18:32:23
本文介绍了禁用属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

由于某些原因,这些DIV都没有呈现禁用状态。奇怪的是,当我在.NET面板上设置Enabled =False时,它将面板显示为禁用=禁用的DIV,这非常棒。

这是我的文档类型:

<!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> < div id =Div1disabled =disabled> < input type =textvalue =blah/> < / div> < div id =disableMedisabled =disabled> < input type =textvalue =blah/> < asp:Panel runat =server> < asp:RadioButtonList runat =server> < asp:ListItem Text =Item1Selected =True/> < asp:ListItem Text =Item2/> < / asp:RadioButtonList> < asp:TextBox runat =serverText =Hello World/> < / asp:面板> < / div>

解决方案

Disabled不是DIV的属性,属性为每个表单元素(如INPUT,SELECT,TEXTAREA)。

只需在DIV中添加disabled属性即可。

For some reason none of these DIVs render disabled. Oddly enough, when I set Enabled="False" on the .NET Panel, then it renders the Panel as a DIV with disabled="disabled", which works great.

Here's my doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <div id="Div1" disabled="disabled"> <input type="text" value="blah" /> </div> <div id="disableMe" disabled="disabled"> <input type="text" value="blah" /> <asp:Panel runat="server"> <asp:RadioButtonList runat="server"> <asp:ListItem Text="Item1" Selected="True" /> <asp:ListItem Text="Item2" /> </asp:RadioButtonList> <asp:TextBox runat="server" Text="Hello World" /> </asp:Panel> </div>

解决方案

Disabled is not an attribute for a DIV, but an attribute for every form element (like INPUT, SELECT, TEXTAREA).

Just add the disabled attribute to ever form element within the DIV.

更多推荐

禁用属性不起作用

本文发布于:2023-11-11 23:00:05,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   属性

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!