<!--#include file="../conn/conn.asp"-->
<%
set Rs=server.createobject("adodb.recordset")
sql="(SELECT 0,product_class_id,product_class_name FROM product_class WHERE Parent_id=0)"
sql=sql & "UNION(SELECT 1,product_class_id,product_class_name FROM product_class"
sql=sql & " WHERE Parent_ID=(SELECT TOP 1 product_class_id FROM product_class WHERE Parent_id=0))"
sql=sql & "UNION(SELECT 2,product_class_id,product_class_name FROM product_class"
sql=sql & " WHERE Parent_ID=(SELECT TOP 1 product_class_id FROM product_class WHERE Parent_ID="
sql=sql & "(SELECT TOP 1 product_class_id FROM product_class WHERE Parent_id=0)))" 
Rs.open sql,conn,1,1
if not Rs.EOF then
ClassInfos=Rs.GetRows()
end if
Rs.Close
%>
<html>
<head>
<title>产品列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
function P_search() 
{
if(document.searchform.Ssearch.value=="")

alert("没有输入关健字");
    return false;
}
}function lb_onchange(ctlname)
{
if(event.propertyName=="value")
{
classid=event.srcElement.options[event.srcElement.selectedIndex].value;
requestForm=document.createElement("FORM");
requestForm.action="class.asp?ClassID=" + classid + "&CtlName=" + ctlname
requestForm.method="post";
requestForm.target="_hideFrame";
requestForm.submit()
}
}
function show_product(ctlname)
{
if(event.propertyName=="value")
{
classid=event.srcElement.options[event.srcElement.selectedIndex].value;
requestForm=document.createElement("FORM");
requestForm.action="product.asp?ClassID=" + classid + "&CtlName=" + ctlname
requestForm.method="post";
requestForm.target="_hideFrame2";
requestForm.submit()
}
}
</script></head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<form method="post" LANGUAGE="javascript" action="index.asp" onsubmit="return p_sesrch()" name=searchform>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="98">
  <tr> 
    <td width="17%" height="12">按产品名查找</td>
    <td width="28%" height="12"> 
      <input type="text" name="Ssearch" style="width:100px,height:18px">
    </td>
    <td height="12" width="22%"> 
      <input type="submit" name="find" value="查 找" style="width:40px,height:18px">
    </td>
    <td width="19%" height="12">&nbsp;</td>
    <td width="14%" height="12">&nbsp;</td>
  </tr>
  <tr> 
    <td width="17%">产品类别:</td>
    <td width="28%"> 
      <select id="rootClass" size="1" class="box" onpropertychange="lb_onchange('childClass')">
<%
if IsArray(ClassInfos) then
for i=LBound(ClassInfos,2) to UBound(ClassInfos,2)
if ClassInfos(0,i)<>0 then exit for
%>
<option value="<%=ClassInfos(1,i)%>"><%=ClassInfos(2,i)%></option>
<%
next
end if
%>
      </select>
    </td>
    <td width="22%" ondblclick="xxx()"> 
      <select id="childClass" size="1" onpropertychange="lb_onchange('_class')">
<%
if IsArray(ClassInfos) then
for i=i to UBound(ClassInfos,2)
if ClassInfos(0,i)<>1 then exit for
%>
<option value="<%=ClassInfos(1,i)%>"><%=ClassInfos(2,i)%></option>
<%
next
end if
%>
      </select>
    </td>
    <td width="19%">
        <select id="_class" size="1" onpropertychange="show_product('product')">
<%
if IsArray(ClassInfos) then
for i=i to UBound(ClassInfos,2)
%>
<option value="<%=ClassInfos(1,i)%>"><%=ClassInfos(2,i)%></option>
<%
next
end if
%>
        </select>
      </td>
    <td width="14%">&nbsp;</td>
  </tr>
  </table>
 <table id=product ondblclick="product.cells[0].innerHTML='<B>你是谁?</B>'">
  <tr> 
    <td width="17%">共查询到:</td>
    <td width="28%">条记录 目前页为</td>
    <td colspan="2">链接码:</td>
    <td width="14%">&nbsp;</td>
  </tr>
  <tr align="center"> 
    <td width="17%">删 除</td>
    <td width="28%">产 品</td>
    <td width="22%">型 号</td>
    <td width="19%">修 改</td>
    <td width="14%">添 加</td>
  </tr>
  
  <tr> 
    <td width="17%" align="center"> 
      <input type="checkbox" name="delchik" value="checkbox">
    </td>
    <td width="28%">&nbsp;</td>
    <td width="22%">&nbsp;</td>
    <td width="19%" align="center"><img src="../image/a_edit.gif" width="52" height="16"></td>
    <td width="14%" align="center"><img src="../image/a_add.gif" width="52" height="16"></td>
  </tr>
</table>
</form>
<iframe name="_hideFrame" src="about:blank" height=300 width=500 style="display:none"></iframe>
<iframe name="_hideFrame2" src="about:blank" height=300 width=500 style="display:"></iframe>
</body>
</html>

解决方案 »

  1.   

    <!--#include file="../conn/conn.asp"-->
    <%
    if Request("ClassID")<>"" and Request("CtlName")<>"" then
    %>
    <SCRIPT language=javascript>
    parent.document.all.<%=Request("CtlName")%>.innerHTML="";
    </SCRIPT>
    <%
    end if
    set Rs=server.createobject("adodb.recordset")
    sql="SELECT product_class_id,product_class_name FROM product_class WHERE parent_id=" & Request("ClassID")
    rs.Open sql,conn,1,1
    if not Rs.EOF then
    ClassInfos=Rs.GetRows()
    end if
    Rs.close
    set Rs=nothing
    Conn.Close
    set Conn=nothing
    if IsArray(ClassInfos) then
    for i=LBound(ClassInfos,2) to UBound(ClassInfos,2)
    %>
    <SCRIPT language=javascript>
    oOption=parent.document.createElement("option")
    oOption.value="<%=ClassInfos(0,i)%>"
    oOption.innerHTML="<%=ClassInfos(1,i)%>"
    parent.document.all.<%=Request("CtlName")%>.appendChild(oOption);
    </SCRIPT>
    <%
    next
    %>
    <SCRIPT language=javascript>
    parent.document.all.<%=Request("CtlName")%>.options[1].selected=true;
    </SCRIPT>
    <%
    end if
    %>