案例:ajax案例     状态:可编辑再运行    进入横版
AخA
<select name="customers" onchange="showCustomer(this.value)" style="font-family:Verdana, Arial, Helvetica, sans-serif;">
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function showCustomer(str)
5
{
6
var xmlhttp;    
7
if (str=="")
8
  {
9
  document.getElementById("txtHint").innerHTML="";
10
  return;
11
  }
12
if (window.XMLHttpRequest)
13
  {// code for IE7+, Firefox, Chrome, Opera, Safari
14
  xmlhttp=new XMLHttpRequest();
15
  }
16
else
17
  {// code for IE6, IE5
18
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
19
  }
20
xmlhttp.onreadystatechange=function()
21
  {
22
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
23
    {
24
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;

 运行结果 
 北美留学生论坛