Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function addJS() {
- var a = document.getElementById("aj").value;
- var b = document.getElementById("bj").value;
- document.getElementById('cj').value = Number(a) + Number(b);
- }
- function showSum() {
- var a = Number(document.getElementById("a").value);
- var b = Number(document.getElementById("b").value);
- var xmlhttp=new XMLHttpRequest();
- xmlhttp.onreadystatechange = function() {
- document.getElementById('c').value=xmlhttp.responseText;
- }
- xmlhttp.open("GET","d1.php?a="+a+"&&b="+b, true);
- xmlhttp.send();
- }
- </script>
- </head>
- <body>
- <form>
- <input type="number" id="a" onchange="showSum()" /> +
- <input type="number" id="b" onchange="showSum()" /> =
- <input type="number" id="c" />
- </form>
- <form>
- <input type="number" id="aj" /> +
- <input type="number" id="bj" /> =
- <input type="number" id="cj" />
- <input type="button" value="JS" onclick="addJS()" />
- </form>
- </body>
- </html>
- <?php echo $_REQUEST["a"]+$_REQUEST["b"]; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement