编辑您的代码:提交代码

x
 
1
 
2
 
3
<html>
4
<head>
5
<script type="text/javascript">
6
function showCustomer(str)
7
{
8
var xmlhttp;    
9
if (str=="")
10
  {
11
  document.getElementById("txtHint").innerHTML="";
12
  return;
13
  }
14
if (window.XMLHttpRequest)
15
  {// code for IE7+, Firefox, Chrome, Opera, Safari
16
  xmlhttp=new XMLHttpRequest();
17
  }
18
else
19
  {// code for IE6, IE5
20
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
21
  }
22
xmlhttp.onreadystatechange=function()
23
  {
24
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
25
    {
26
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
27
    }
28
  }
29
xmlhttp.open("GET","/ajax/getcustomer.asp?q="+str,true);
30
xmlhttp.send();
31
}
32
</script>
33
</head>
34
<body>
35
36
<form action="" style="margin-top:15px;"> 
37
<label>请选择一位客户:
38
<select name="customers" onchange="showCustomer(this.value)" style="font-family:Verdana, Arial, Helvetica, sans-serif;">
39
<option value="APPLE">Apple Computer, Inc.</option>
40
<option value="BAIDU ">BAIDU, Inc</option>
41
<option value="Canon">Canon USA, Inc.</option>
42
<option value="Google">Google, Inc.</option>
43
<option value="Nokia">Nokia Corporation</option>
44
<option value="SONY">Sony Corporation of America</option>
45
</select>
46
</label>
47
</form>
48
<br />
49
<div id="txtHint">客户信息将在此处列出 ...</div>
50
51
</body>
52
</html>
53
            

查看结果:

请在上面的文本框中编辑您的代码,然后单击提交按钮测试结果。w3c0.com

W3c0.com 提供的内容仅用于培训。我们不保证内容的正确性。通过使用本站内容随之而来的风险与本站无关。W3c0 简体中文版的所有内容仅供测试,对任何法律问题及风险不承担任何责任。 当使用本站时,代表您已接受了本站的使用条款和隐私条款。版权所有,保留一切权利。 鲁ICP备15022115号