Javascript function for changing label color
<script type="text/javascript">
function ChangeLabelColor()
{
document.getElementById("Label1").style.color = "#FF3300";
}
</script>
Complete Source Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function ChangeLabelColor()
{
document.getElementById("Label1").style.color = "#FF3300";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
<input id="Button1" type="button" value="Change Label Color" onclick="ChangeLabelColor();"/>
</form>
</body>
</html>
Related posts:
No Comments