html
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<!--360,以webkit内核进行渲染-->
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<!--以最新内核进行渲染。-->
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<!--百度禁止转码-->
<title>moyu demo</title>
<meta name="keywords" content="demo 测试 魔芋">
<meta name="description" content="魔芋的测试示例">
<meta name="author" content="魔芋,[email protected],http://www.cnblogs.com/moyuling/">
<meta name="robots" content="index,follow">
<!--定义网页搜索引擎索引方式-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<style>
</style>
</head>
<body>
<script>
function showUser(str){
if(str ==""){
document.getElementById("txtHint").innerHTML ="";
return;
}
if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp =newXMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp =newActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange =function(){
if(xmlhttp.readyState ==4&& xmlhttp.status ==200){
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://localhost/moyu.php?q="+ str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">PeterGriffin</option>
<option value="2">LoisGriffin</option>
<option value="3">GlennQuagmire</option>
<option value="4">JosephSwanson</option>
</select>
</form>
<br>
<div id="txtHint"><b>Person info will be listed here.</b></div>
</body>
</html>
php
<?php
$q=$_GET["q"];
echo "$q";
?>
魔芋测试:
时间: 2024-12-19 20:29:56