by Gehan Fernando (47 Submissions)
Category: Internet/HTML
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Tue 26th April 2011
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Change Button Text Using Java Script
function changeText(value) {
document.getElementById('<%= Label1.ClientID %>').innerHTML = value;
}
</script>
<head runat="server">
<title>Change Text</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
<br />
<asp:Button ID="ButtonOne" runat="server" Text="Button One" OnClientClick="changeText('Button One');return false;" />
<asp:Button ID="ButtonTwo" runat="server" Text="Button Two"
OnClientClick="changeText('Button Two');return false;"/>
<asp:Button ID="ButtonThree" runat="server" Text="Button Three"
OnClientClick="changeText('Button Three');return false;" />
<br />
</form>
</body>
</html>