• 我的二级联动下拉框(方便以后查询)


    var subcat2 = new Array();
    <?
    $i=0;
    $sql="select * from cat_small ";//查询所有小类
    $result=mysql_query($sql);
    while($rs=mysql_fetch_array($result))
    {
     echo "subcat2[".$i++."] = new Array('".$rs["id"]."','".$rs["cat_bigId"]."','".$rs["cat_name"]."');\n";
    }
    ?>

    function changeselect1(locationid)
    {

    document.leave_word.s2.length = 0;
    document.leave_word.s2.options[0] = new Option('请选择','');
     //alert(subcat2[1].toString());
     //alert(locationid.length.toString());
    for (i=0; i<subcat2.length; i++)
    {
     if (subcat2[i][1] == locationid)
    {
     document.leave_word.s2.options[document.leave_word.s2.length] = new Option(subcat2[i][2], subcat2[i][0]);}
    }
    }

    </script>
    <form method="post" action="mian.php" enctype="multipart/form-data" name="leave_word" onSubmit="return checkname()">
    <?php
      if(isset($_SESSION['name'])){

    ?>


    <table align="center" style="margin-top:50px;">
     <tr>
      <td style="font-size:12px;">用户<?=htmlspecialchars($_SESSION['name'])?></td>
      <td height="23"> <a href="regok.php?action=out">注销</a></td>
      </tr>

      <tr>
      <td style="font-size:12px;">上传文件:</td>
      <td height="23">

      <select name="s1" width="20" onChange="changeselect1(this.value)">
        <option  selected>请选择</option>
      <?php
       $sql = "select * from cat_big order by id ";
       $result = mysql_query($sql);
       $row = mysql_num_rows($result);

       while($rs = mysql_fetch_array($result)) {
          echo "<option value=\"".$rs['id']."\" >";
          echo $rs['cat_name'];
          echo "</option>";
       }
    ?>

     </select>
       <select name="s2">
        <option selected>请选择</option>
       </select>
       <input type="hidden" name="MAX_FILE_SIZE" value="20000">
      <input type="file" name="filename" style="height:20px; line-height:16px; 300px;"> </td>
      </tr>
      <tr>
      <td style="font-size:12px;">描述:</td>
      <td height="23"><textarea name="textname" style="height:100px; 440px;"></textarea></td>
      </tr>
      <tr>
      <td></td><td height="23" align="center">
      <input type="image" src="images/input01.gif" />
      <img src="images/input02.gif" style="cursor:hand" onClick="document.all.leave_word.reset()" /></td>
     </tr>

    </table>

  • 相关阅读:
    JS---元素属性的操作
    JS---异常
    JS---OOP
    T-SQL---分页语句
    mui---在关闭webview之前给出提示
    mui---通过plus.webview.create创建webview并打开新页面并传参到新页面
    mui---要打开的页面loaded不自动显示,等服务器返回数据后,再做处理逻辑
    winform/timer控件/权限设置/三级联动
    winform 进程、线程
    winform 之MDI容器
  • 原文地址:https://www.cnblogs.com/freespider/p/1711702.html
Copyright © 2020-2023  润新知