arnex

JavaScript - Aspnet

Feb 23rd, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 0.97 KB | None | 0 0
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7.     <title></title>
  8.     <script language="javascript" type="text/javascript">
  9.         function sum() {            
  10.             var x = document.getElementById('<%= txtA.ClientId %>');
  11.             var a = x.value;
  12.             var y = document.getElementById('<%= txtB.ClientId %>');
  13.             var b = y.value;
  14.             var c = a + b;
  15.             alert(c);
  16.         }
  17.     </script>
  18. </head>
  19. <body>
  20.     <form id="form1" runat="server">
  21.     <div>
  22.         <asp:TextBox ID="txtA" runat="server" />
  23.         <asp:TextBox ID="txtB" runat="server" />
  24.         <span id="a" />
  25.         <input type="button" onclick="javascript: return sum();"  />
  26.     </div>
  27.     </form>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment