“三级联动”是什么东西???

解决方案 »

  1.   

    我刚做了一个啊,hehe
    <iframe frameborder=0 scrolling=no src="list_edusubject.php?SubjectID=<?php echo $SubjectID; ?>" hspace='0' vspace='0' width=460 height=70></iframe>
                                <input name="SubjectID" type="hidden" id="SubjectID" value="<?=$SubjectID?>">                其他代码略....list_edusubject.php代码为:
    <?php
    //**********************************************
    //* 文件:list_edusubject.php
    //* 功能:三级连动菜单
    //* 版权所有: CopyRight By Zwon.net 2005
    //* 创建者:王友兴
    //* 创建时间:2005-03-27
    //* 来源:
    //* 参数:
    //* 数据库操作:edusubject
    //* 输出:
    //**********************************************require "../conf/config.php";
    //include "check.php";
    //权限检查
    //check_admin("h");//载入无限分类目录树函数
    $tmp_class_t = $edusubject_t; //此处功能为,使用新闻类别的表,作为在tree_func.php中的$tmp_class_t的
    include "../conf/tree_func.php";//载入js代码
    require "../conf/js_setselect.php";
    require "../conf/js_select.php";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="../style/style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    }
    -->
    </style></head>
    <body>
    <SCRIPT laguage="javascript">
    function SetData(value) {
    var value;
    parent.document.all.SubjectID.value = value;
    }</SCRIPT>
    <table width="100%"  border="0">
    <form action="" method="post" name="FormAdd" id="FormAdd">
      <tr> 
    <td style="line-height:150%">
    <select name="SubjectID_1" id="SubjectID_1" onChange="SetData(this.value);this.form.submit();">
                    <option value="" selected>请选择一级分类</option>
    <?php
    //如果变量EdulevelID存在,则表示是修改,则给以下变量赋值
    if ($SubjectID) {
    $SubjectID_1 = substr($SubjectID, 0 ,3);
    $SubjectID_2 = substr($SubjectID, 0 ,6);
    $SubjectID_3 = substr($SubjectID, 0 ,9);
    }
    //显示所有的栏目
    $db->query("select ClassID,Name from $tmp_class_t where length(ClassID)=3 order by Display,ID");
    //找出最上层节点(祖宗节点),根据需要自己修改,3表示最多目录级别可有999个
    while($db->next_record()) //循环取出所有的祖宗节点
    {
    echo "<option value=\"" . $db->f('ClassID') . "\"";
    if ($SubjectID_1 == $db->f('ClassID')) echo " selected";
    echo ">" . $db->f('Name') . "</option>\n";
    ListChildTreeOption($SearchClass,$BaseNum);
    } //循环结果
    ?>
      </select>
        </td>
      </tr>
      <tr>
        <td><?php
    //如果此此值为空,则以post方式取得表单数据
    if ($SubjectID_1 == "") $SubjectID_1 = $_POST[SubjectID_1];
    //如果已经选择了大类
    if ($SubjectID_1) {
    ?>
    <select name="SubjectID_2" id="SubjectID_2" onChange="SetData(this.value);this.form.submit();">
      <option value="" selected>请选择二级分类</option>
        <?php
    //显示所有的栏目
    $db->query("select ClassID,Name from $tmp_class_t where length(ClassID)=6 and ClassID like '" . $SubjectID_1 . "___' order by Display,ID");
    //找出最上层节点(祖宗节点),根据需要自己修改,3表示最多目录级别可有999个
    while($db->next_record()) //循环取出所有的祖宗节点
    {
    echo "<option value=\"" . $db->f('ClassID') . "\"";
    if ($SubjectID_2 == $db->f('ClassID')) echo " selected";
    echo ">" . $db->f('Name') . "</option>\n";
    } //循环结果
    ?>
      </select>
      <?php  } ?>
      </td>  
      </tr>
      <tr>
        <td><?php
    //如果此此值为空,则以post方式取得表单数据
    if ($SubjectID_2 == "") $SubjectID_2 = $_POST[SubjectID_2];
    //如果已经选择了大类
    if ($SubjectID_2) {
    ?>
    <select name="SubjectID_3" id="SubjectID_3" onChange="SetData(this.value);">
      <option value="" selected>请选择三级分类</option>
        <?php
    //显示所有的栏目
    $db->query("select ClassID,Name from $tmp_class_t where length(ClassID)=9 and ClassID like '$SubjectID_2%' order by Display,ID");
    //找出最上层节点(祖宗节点),根据需要自己修改,3表示最多目录级别可有999个
    while($db->next_record()) //循环取出所有的祖宗节点
    {
    echo "<option value=\"" . $db->f('ClassID') . "\"";
    echo ">" . $db->f('Name') . "</option>\n";
    $FirstClass=$db->f("ClassID");
    $SearchClass=$FirstClass."___";    //设置查找条件 "_",此号在mysql中,作为匹配单个的字符
    ListChildTreeOption($SearchClass,$BaseNum);
    } //循环结果
    ?>
        </select>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    setSelect("FormAdd","SubjectID_3","<?php echo $SubjectID; ?>");
    //-->
    </SCRIPT>
      <?php  } ?></td>
      </tr>
      </form>
    </table>  
    </body>
    </html>