易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : ajax

AJAX实现二级级联菜单

 AJAX实现二级级联菜单,用PHP完成,客户端代码:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
var xmlHttp;
var a =new Array();
function createXMLHttpRequest(){
   if(window.ActiveXObject){
     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   else if(window.XMLHttpRequest){
      xmlHttp=new XMLHttpRequest();
   }
}
function send_request(){
 createXMLHttpRequest();
 var year = document.getElementById("year");
 
 var url = "check_2.php?page="+escape(year.value);
 xmlHttp.open("GET",url,true);
 xmlHttp.onreadystatechange = checkit;&n ......

ajax 局部刷新分页和自动搜索提示

 前台HTML代码:
<!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>
    <title>无标题页</title>
    <style type="text/css">
    a { text-decoration:none;}
    </style>
    <script type="text/javascript">
    var xmlHttp;
    function CreateXmlHttp()
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    function StartRequest(index)
    {
      // alert("1");
        var url="repeater.aspx?index="+index+"&key="+escape(document.getElementById("tip").value);
        //alert(url);
   &n ......

AJAX实时读取输入文本

 客户端String.php,服务器端String_check.php,很简单的实现。
客户端代码:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
var xmlHttp;
function createXMLHttpRequest(){
 if(window.ActiveXObject){
  xmlHttp = new ActiveXObject("microsoft.XMLHTTP");
 }
 else if(window.XMLHttpRequest){
  xmlHttp = new XMLHttpRequest();
 }
}
function sendRequest(){
 
 createXMLHttpRequest();
 
 var name = document.getElementById("name").value;
 url = "String_check.php?page="+name;
 xmlHttp.onreadystatechange = callback;
 xmlHttp.open('GET',url,true); 
 xmlHttp.send(null);
}
function callbac ......

AJAX动态获取当前时间

 利用AJAX动态获取当前时间,客户端time.php,服务器端time_check.php
客户端代码:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态显示时间</title>
</head>
<script language="javascript">
var xmlHttp;
function createXMLHttpRequest(){
 if(window.ActiveXObject){
  xmlHttp = new ActiveXObject("microsoft.XMLHTTP");
 }
 else if(window.XMLHttpRequest){
  xmlHttp = new XMLHttpRequest();
 }
 else{
  alert("创建请求失败");
 }
}
function sendRequest(){
 createXMLHttpRequest();
 url = "time_check.php";
 xmlHttp.onreadystatechange = callback;
 xmlHttp.open('GET',url,true);
 xmlHttp.send(null);
}
function callback(){
 if(xmlHttp.rea ......

ajax学习录

有关ajax的其实就是1个类的使用:XMLHttpRequest.
首先要声明这个类的对象,鉴于各个浏览器把这个类嵌入的方式不同,声明的方式也不同:
  var xmlHttpReq = null;
if (window.XMLHttpRequest) //Mozilla 浏览器
{
    xmlHttpReq = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) // IE浏览器
{
try
{
xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("您的浏览器不支持AJAX!") ;
}
}   
  }
else
{
alert("您的浏览器不支持AJAX!") ;
}
然后是open,send,getresponse
 xmlHttpReq.open("POST","http://localhost///6gold/home_validate.php",true);
xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttpReq.onreadystatechange = function()
{
if (xmlHttpReq.readyState == 4)
{
if (xmlHttpReq.status == 200)
{
......

AJAX实现鼠标悬浮获取值

 ajax实现将鼠标放到图标上,下方会显示和该图有关的信息
客户端代码mouseover.php
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>鼠标悬浮测试</title>
</head>
<script type="text/javascript" language="javascript">
var xmlHttp;
function createXMLHttpRequest(){
 if(window.ActiveXObject){
  xmlHttp = new ActiveXObject("microsoft.XMLHTTP");
 }
 else if(window.XMLHttpRequest){
  xmlHttp = new XMLHttpRequest();
 }
}
function sendRequest(t){
 var id = t.id
 createXMLHttpRequest(); 
 var url = "mouseover_check.php?page=" +t.id ; 
 xmlHttp.onreadystatechange = callback;
 xmlHttp.open('GET',url,true);
 xmlHttp.send(null);
}
function callback(){ ......
总记录数:703; 总页数:118; 每页6 条; 首页 上一页 [91] [92] [93] [94] 95 [96] [97] [98] [99] [100]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号