对着这个做的 整的头都大了 还没整出来 <!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" lang="gb2312"> <head> <head> <title> </title> <meta http-equiv="content-type" content="text/html; charset=gb2312" /></head> <body> <select id="Distinction" name="Distinction" size="1" onchange="Redirect(this.options.selectedIndex)"> <option selected value="0">选择类型</option> <option value="购买">购买</option> <option value="消耗">消耗</option> </select> <select id="purpose" name="purpose" size="1"> <option value="1">选择类型</option> </select> <script type="text/javascript"> <!-- var groups = document.getElementById("Distinction").options.length; var group = new Array(groups) for (i = 0; i < groups; i ++) group[i] = new Array()group[0][0] = new Option("选择类型","0")group[1][0] = new Option("购买券","购买券") group[1][1] = new Option("物换券","物换券") group[1][2] = new Option("兑换券","兑换券")group[2][0] = new Option("券换物","券换物") group[2][1] = new Option("兑换券","兑换券")var temp = document.getElementById("purpose"); function Redirect(x){ for (m = temp.options.length-1; m > 0; m --) temp.options[m] = null for (i = 0; i < group[x].length; i ++){ temp.options[i] = new Option(group[x][i].text,group[x][i].value);
<!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" lang="gb2312">
<head>
<head>
<title> </title>
<meta http-equiv="content-type" content="text/html; charset=gb2312" /></head>
<body>
<select id="Distinction" name="Distinction" size="1" onchange="Redirect(this.options.selectedIndex)">
<option selected value="0">选择类型</option>
<option value="购买">购买</option>
<option value="消耗">消耗</option> </select>
<select id="purpose" name="purpose" size="1">
<option value="1">选择类型</option>
</select>
<script type="text/javascript">
<!--
var groups = document.getElementById("Distinction").options.length;
var group = new Array(groups)
for (i = 0; i < groups; i ++)
group[i] = new Array()group[0][0] = new Option("选择类型","0")group[1][0] = new Option("购买券","购买券")
group[1][1] = new Option("物换券","物换券")
group[1][2] = new Option("兑换券","兑换券")group[2][0] = new Option("券换物","券换物")
group[2][1] = new Option("兑换券","兑换券")var temp = document.getElementById("purpose");
function Redirect(x){ for (m = temp.options.length-1; m > 0; m --)
temp.options[m] = null
for (i = 0; i < group[x].length; i ++){
temp.options[i] = new Option(group[x][i].text,group[x][i].value);
}
temp.options[0].selected = true
}
//-->
</script></body>
</html>
$("#product").find("option").remove(); //先移除产品原有的选项
if (msg == "") return;
var json = eval('(' + msg + ')');
for (var i = 0; i < json.length; i++) {
$("#product").append('<option value="' + json[i].autoid + '">' + decodeURI(json[i].uname) + '</option>');
}
<title></title>
<script language="JavaScript">
<!--
var reobj = null;
var http_request = false;if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHttp");
}catch(e){
try{
http_request=new ActiveXobject("Microsoft.XMLHttp");
}catch(e){}
}
} function send_request(url){
if(!http_request){
window.alert("创建XMLHttp对象失败!");
return false;
}
http_request.open("GET",url,true);
http_request.onreadystatechange=processrequest;
http_request.send(null);
}//处理返回信息的函数
function processrequest(){
if(http_request.readyState==4){ //判断对象状态
if(http_request.status==200){ //信息已成功返回,开始处理信息
document.getElementById(reobj).innerHTML=http_request.responseText;
}
else{
alert("您所请求的页面不正常!");
}
}
}
function getclass(obj){
var pid=document.form1.select1.value; document.getElementById(obj).innerHTML="<option>loading...</option>";
reobj=obj;
send_request("newfile.php?pid="+pid);
}
//-->
</script>
</head><body>
<form name="form1"><select name="select1" id="class1" onChange="getclass('class2');">
<option selected="selected">请选择大类</option><?php
$sql=mysql_query("select * from producttype");
while ($row=mysql_fetch_array($sql)){
?><option value="<?php echo $row['Id']?>"><?php echo $row['name']?></option>
<?php }
?>
</select>
<div id="class2">
</div>
</form></body>newfile:
<?php
include("inc/conn.php");
$pid=$_GET['pid'];$sql=mysql_query("select * from product where _id=$pid");?>
<select id="product" name="product" size="1">
<?php
//循环列出选项
while($rows=mysql_fetch_array($sql))
{
?>
<option value="1"><?php echo $rows['name']?></option>
<?php
}?>
</select>