English 中文(简体)
在 IE 中禁用工作, 但不在 firefox 中
原标题:disabled works in IE but not in firefox

这是我在负载功能上 需要禁用 btndelete... 它在iE 中工作正确,但在火狐中工作, 但是它不是调味品. 我不知道这是Css问题还是什么?

< 强力 > 标注

 window.onload = body_Onload;

            function body_Onload()
            {
                    var btnDelete = document.getElementById( <%=btnDelete.ClientID%> );
                btnDelete.disabled = true;
            }

< 强 > HTML

<asp:Button ID="btnDelete" runat="server" CssClass="cssbutton" Text="Delete" Width="60px" OnClick="btnDelete_Click" />

<强 > CSS

.cssbutton
{
    font-weight: bold;  
    border-right: #3C8FD1 1px solid;
    border-top: #3C8FD1 1px solid;
    border-left: #3C8FD1 1px solid;
    border-bottom: #3C8FD1 1px solid;
    font-size: 10px;
    color: #045FA7;
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-image: url(../App_Images/cssbuttonbg.gif);
    line-height: 14px;
}

<强 > HTML 生成代码

<input type="submit" name="pageMain$contentPlaceHolderMain$btnDelete" 
    value="Delete" onclick="return btnDelete_Click();"
    id="contentPlaceHolderMain_btnDelete" class="cssbutton" style="width:60px;"/>
最佳回答

以下是我以你的问题和评论中的信息为根据的一页例子:

这在 IE 和 FireFox 中都有效。 区别在于, 在 IE 中, 当禁用时按钮会被灰化。 在 FireFox 中, 按钮看起来是一样的, 但被禁用了 。 所以您可能想要为它指定一个班级, 并给 FireFox 指定灰色的样式 。

<!DOCTYPE html>
<html>
<head>

<script>
function body_Onload()
{
    var btnDelete = document.getElementById( contentPlaceHolderMain_btnDelete );
        btnDelete.disabled = true;
        btnDelete.className +=   btndisabled ;
}
</script>
<style>
.cssbutton
{
    font-weight: bold;  
    border-right: #3C8FD1 1px solid;
    border-top: #3C8FD1 1px solid;
    border-left: #3C8FD1 1px solid;
    border-bottom: #3C8FD1 1px solid;
    font-size: 10px;
    color: #045FA7;
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-image: url(../App_Images/cssbuttonbg.gif);
    line-height: 14px;
}
.btndisabled 
{
    background-color: rgb(236,233,216);
    color: #CCC;
    font-style:normal;
}
</style>
</head>
<body onload="body_Onload();">
<form>
<input type="submit" name="pageMain$contentPlaceHolderMain$btnDelete" 
    value="Delete" onclick="return btnDelete_Click();"
    id="contentPlaceHolderMain_btnDelete" class="cssbutton" style="width:60px;"/>
</form>
</body>
</html>
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签