reset and begin
7/06/2009

ajax + caculator simple

<html> <head>  </head>   <body>
<script language="javascript" type="text/javascript">
function ajax() { var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); }
catch(e){ try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e){ try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e){ alert("Error"); } } } ajaxRequest.onreadystatechange = function()
{ if(ajaxRequest.readyState == 4) { document.myForm.kq.value = ajaxRequest.responseText; }
} var so1 = document.getElementById("so1").value;
var so2 = document.getElementById("so2").value;
var pt = document.getElementById("pt").value;
ajaxRequest.open("GET","tinhtoan.php?so1="+so1+"&pt="+pt+"&so2="+so2,true);
ajaxRequest.send(null); } < /script>
<form name="myForm"> So 1 <input type="text" id="so1"> So 2
<input type="text" id="so2">
Chon phep tinh : <select id="pt" onChange="ajax()">
<option value="cong">Cong</option>
<option value="tru">Tru</option>
<option value="nhan">Nhan</option>
<option value="chia">Chia</option>
</select> Ket qua
<input type="text" id="kq">
</form> </body> </html>

Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .