All pastes #241451 Raw Edit

Untitled

public text v1 · immutable
·published 2006-11-06 05:35 UTC
rendered paste body
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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>Untitled Page</title>
    <script type="text/javascript">
        var xmlHttp;

        function createXMLHttpRequest()
        {
            if(window.ActiveXObject)
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            else if (window.XMLHttpRequest)
            {
                xmlHttp = new XMLHttpRequest();
            }
        }
        function updateTotal()
        {
            frm = document.forms[0];
            
            url="Default2.aspx?A=" + frm.elements['A'].value + "&B=" + frm.elements['B'].value;
            xmlHttp.open("GET",url,true);
            xmlHttp.onreadystatechange=doUpdate;
            xmlHttp.send();
            return false;
        }
        function doUpdate()
        {
        if (xmlHttp.readyState==4)
        {
            document.forms[0].elements['TOT'].value=xmlHttp.responseText;
        }
    }
    </script>
</head>
<body onload="createXMLHttpRequest();">
    <form>
        <table cellspacing="0" cellpadding="0" width="300" border="0">
            <tr valign="top">
                <td height="32">First Value</td>
                <td><input type="text" id="A" value="0" onkeyup="updateTotal();" /></td>
            </tr>
            <tr valign="top">
                <td height="32">Second Value</td>
                <td><input type="text" id="B" value="0" onkeyup="updateTotal();" /></td>
            </tr>
            <tr valign="top">
                <td height="23">Returned Total</td>
                <td><input type="text" id="TOT" value="0" /></td>
            </tr>
        </table>
    </form>
</body>
</html>