禁用属性不起作用 [英] disabled attribute not working

查看:108
本文介绍了禁用属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这是我的文档类型:

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/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" "http://www.w3.org/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.

这篇关于禁用属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆