Hi All,
I am trying to retrieve the value of a label set in Javascript (code below). I am trying to do this in a button event handler, does anyone know how to do this? in the button handler I need to retrieve the calculated value of Label1 and assign it to Label2
Any ideas?<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" >
function updateTotals()
{
cost = 0;
total = 0
T = document.getElementById( "Textbox1" );
cost = parseFloat( T.value );
if ( isNaN(cost) )
cost = 0;
total = total + cost;
T = document.getElementById( "Textbox2" );
cost = parseFloat( T.value );
if ( isNaN(cost) )
cost = 0;
total = total + cost;
L = document.getElementById( "Label1" );
L.innerHTML = total;
}
</script>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = Label1.Text;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1&q
View Complete Post