I have a piece of code in javascript which calculates something ,
There is a label in asp.net application , How can I get the value of it from javascript ?
here is i have tried :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.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>JASP</title>
<script type="text/javascript">
var x = document.getElementById("Label1").innerHTML;
alert(x);
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="My Text"></asp:Label>
</form>
</body>
</html>