首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读1596次
PHP MYSQL 通用数据处理 AJAX WINDOWS

ajax.html
<html>
<body>
<script language="JavaScript">
<!--
var agt = navigator.userAgent.toLowerCase();
var is_opera = (agt.indexOf("opera") != -1);
var is_ie = (agt.indexOf("msie") != -1) && document.all && !is_opera;
var is_ie5 = (agt.indexOf("msie 5") != -1) && document.all;
/**
 * XML Http requests
 */
function CreateXmlHttpReq(handler) {
 var xmlhttp = null;
 if (is_ie) {
  // Guaranteed to be ie5 or ie6
  var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
  try {
   xmlhttp = new ActiveXObject(control);
   } catch(e) {
   // TODO: better help message
   alert("You need to enable active scripting and activeX controls");
   }
  } else if(typeof XMLHttpRequest!='undefined'){
  // Mozilla
  xmlhttp = new XMLHttpRequest();
  }
 xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
   //alert( xmlhttp.statusText);//ok
   handler(xmlhttp);
   }
  };
 return xmlhttp;
}

// Send a request to the server
function StartGETRequest(url, handler) {
 var xmlhttp = CreateXmlHttpReq(handler);
 xmlhttp.open('GET', url, true);
 xmlhttp.send(null);
}


function addclick(){
 a = document.getElementById("txtbox_a").value;
 b = document.getElementById("txtbox_b").value;
 echoResult = function(xmlhttp){
  document.getElementById('result').innerHTML = "Result:" + xmlhttp.responseText;
  }
 StartGETRequest("calculator.php?a="+a+"&b="+b,echoResult);
}
//-->
</script>
<input id=txtbox_a value=1><br>
<input id=txtbox_b value=1><br>
<INPUT onclick=addclick() type=button value=Add name=Button>
<DIV id=result>Result:2</div>
</body>
</html>

calculator.php
<?
echo $_GET["a"] + $_GET["b"];

不过只能在WINDOWS下运行~~~ 那么这个实际上就没有什么意义呢?


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/phpmysqlajaxwin.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1130558800

2005年10月29日12:06星期六  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 7||用户: 2563 [列表]
今日:483||到访:2682122
Rss:841890||评论:1585

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8