Definitely, there are errors:
1. Where is no "L2T", you are attaching a click event listener to it and it is no where to be found. I assume it is a button.
2. The addEventListener was declared before the L2T was created as it is placed before the loading of supposedly a L2T in the body.
3. Do not use static id in asp.net as the run time id could be different, refer:
ASP.NET 4.0 Client ID Feature[
^]
Let's see the correct version:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Lbl" runat="server" Text="UserName"></asp:Label>
<asp:TextBox ID="Txt" runat="server"></asp:TextBox>
<asp:Button ID="L2T" runat="server" Text="Button" />
</div>
</form>
<script type = "text/javascript">
function labelToText(lblConversionFactor, txtConversionFactor) {
document.getElementById(txtConversionFactor).value =
document.getElementById(lblConversionFactor).innerHTML;
}
document.getElementById("L2T").addEventListener("click", function () {
labelToText("<%= Lbl.ClientID %>", "<%= Txt.ClientID %>");
});
</script>
</body>
</html>
++++++++++[Round 2}+++++++++++++++
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Lbl" runat="server" Text="UserName"></asp:Label>
<asp:TextBox ID="Txt" runat="server"></asp:TextBox>
</div>
</form>
<script type = "text/javascript">
function labelToText(lblConversionFactor, txtConversionFactor) {
document.getElementById(txtConversionFactor).value =
document.getElementById(lblConversionFactor).innerHTML;
}
labelToText("<%= Lbl.ClientID %>", "<%= Txt.ClientID %>");
</script>
</body>
</html>