index.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">//This Is JavaScript Document
function CreateXHR(){var request;
//返回浏览器的名称
var browser = navigator.appName;//使用IE,则使用XMLHttp对象
if(browser == "Microsoft Internet Explorer"){   var arrVersions = ["Microsoft.XMLHttp", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","MSXML2.XMLHttp.5.0"];
   for (var i=0; i < arrVersions.length; i++){    try{     //从中找到一个支持的版本并建立XMLHttp对象
     request = new ActiveXObject(arrVersions[i]);
     return request;    }    catch(exception){
    //忽略,继续
    }   }}else{   //否则返回一个XMLHttpRequest对象
   request = new XMLHttpRequest();
   if(request.overrideMimeType){    request.overrideMimeType('text/xml;charset=gb2312');   }    return request;} }//实例化
var Request = new CreateXHR();function show2(x){
alert(x);
var URL = "out2.php?value=" + x;     
Request.open("GET", URL, true);
Request.onreadystatechange = Show_Second;
Request.send(null);}function Show_Second(){if(Request.readyState == 4 && Request.status == 200){
  
   //显示二级框
   document.getElementById("cclass").style.display = '';
   //读取返回的xml数据
    alert("111111111");


   var myData = Request.responseXML.getElementsByTagName("row");
   
   //如果数据长度为0,则表示没有取到数据,则不显示二级菜单
   if(myData.length == 0){    document.getElementById("cclass").style.display = '';
  
   }   var myStr   = new Array();
   var myValue = new Array();   for(var i = 0; i < myData.length; i++){    myStr[i]   = myData[i].firstChild.data;
    myValue[i] = myData[i].getAttribute("value");   }
   document.getElementById("cclass").options.length = 0;      for(var j = 0;j<myStr.length;j++){    document.getElementById("cclass").options[document.getElementById("cclass").options.length] = new Option(myStr[j], myValue[j]);   }}}</script>
<body><?php 
 $conn=mysql_connect("localhost","root","");

if(!$conn)
{
die("数据库连接错误");
} mysql_select_db("jvj",$conn);
mysql_query("set names gb2312");


$sql="select type_name,pid from pro_type group by pid";
$rs=mysql_query($sql,$conn);

?>
<script>/*var pp=document.getElenmentById('pclass');var vv=pp.options[select.selectedIndex].value;alert(vv);*/</script>
<form>
  <select onchange="show2(this.value)" id="pclass" name="pclass">
  
  <?php
   while($row=mysql_fetch_array($rs)){
       ?>
  
  <option  value="<?php echo $row[1];?>"><?php echo($row[0]);?></option>
   <?php } ?>
  </select>
  
  <select id="cclass" name="cclass" style="display:none;">
  <!-- <option name="row"></option>-->
  </select>
  
</form>
</body>
</html>out2.php:<?php
我做的个冲数据读取数据 实现产品大小类的联动 第二个下拉列表 怎么没有内容
//必要的
header("Content-Type:text/xml;charset=gb2312");$value = $_GET['value']; $conn=mysql_connect("localhost","root","");

if(!$conn)
{
die("数据库连接错误");
} mysql_select_db("jvj",$conn);
mysql_query("set names gb2312");
/*$link = mysql_connect("localhost","root","") or die("链接数据库失败");
mysql_select_db("jvj", $link);*/
$sql = "SELECT id, type_name FROM pro_type WHERE pid = ".$value;
echo("<script >alert($sql.'sssssssss');</script>");
$result = mysql_query($sql, $conn);
$data = '';/*while(list($cid, $class) = mysql_fetch_row($result))*/
/*while($row=mysql_fetch_array($rs))
{$data .= "<option value='$row[1]'>$row[1]</option>";}*/
while(list($id, $type_name) = mysql_fetch_row($result)){$data .= "<row value='{$id}'>{$type_name}</row>";}
//要显示的信息
echo "<data>".$data."</data>";
/*echo("<option>".$data."</option>");*/
mysql_close($conn);/**/?>好像 从 这里 echo("<script >alert($sql.'sssssssss');</script>"); 就不往下执行了 数据查询语句正确 就是不能读出来数据赋值给 index.php 页面的
<select id="cclass" name="cclass" style="display:none;">
  <!-- <option name="row"></option>-->
  </select>
了