开发者

ASP.NET: Disabling a LinkButton via javascript

I'm trying to disable a LinkButton on my aspx page.

It see开发者_StackOverflowms to disable OK, but I'd really like it to be greyed out. Here's what I'm using:

function DisableVehicles()
{
 document.form1.lstVehicles.disabled = true;
 document.getElementById("<%= InsertVehicles.clientID %>").enabled = false;
 document.getElementById("<%= InsertVehicles.clientID %>").onclick = function() {return false;}; 
}

The LinkButton looks like this:

<asp:LinkButton ID="InsertVehicles" BorderStyle="Solid" Font-Underline="False" Font-Size="Small" Font-Names="Tahoma" BackColor="#20548E" ForeColor="White" Height="16px" Width="150px" BorderColor="#20548E" runat="server"><center>Insert Vehicles</center></asp:LinkButton>

Is there any way to make it LOOK like a standard, disabled control? (ie: greyed out?)

Thanks,

Jason


Maybe code like these (you give all your button elements class .button in CSS):

.button[disabled=true], .button[disabled=true]:hover,
.button[disabled=disabled], .button[disabled=disabled]:hover
 {
  color: #cecece;
  cursor:text !important;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜