级联菜单

<?php 
    header("content:text/html;charset=utf8");
    $con=@mysql_connect("localhost","root","");
    mysql_select_db("hnthdl",$con);
    mysql_query("set names utf8");    
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf8">
    <title>Document</title>
</head>
<script>
    function selectcity(x){
        if(x!="请选择"){
            window.location.href='test.php?pid='+x;
        }
    }
    function selecttown(x){
        if(x!="请选择"){
            window.location.href='test.php?cid='+x+"&pid="+form1.hnthdl_area.value;
        }
    }
</script>
<body>
    <?php 
        session_start();
        if(@$_GET["pid"]!=""){ $_SESSION["pid"]=@$_GET["pid"]; }
        if(@$_GET["cid"]!=""){ $_SESSION["cid"]=@$_GET["cid"]; }
     ?>
<form  name="form1">
  <table >   
      <tr>
        <td><span>级联菜单的应用</span></td>
      </tr>
      <tr>
        <td><span>省级名称:</span></td>   
         <td><select name="hnthdl_area" onChange="selectcity(this.value);">
           <option value="请选择">请选择</option>   
         <?php 
            $query=mysql_query("select * from hnthdl_area");
            $myrow=mysql_fetch_array($query);
            if($query==true){
                do{ 
        ?> 
           <option value="<?php echo $myrow["id"];?>"
        <?php
            if(@$_SESSION["pid"]!="") {
                if(@$_SESSION["pid"]==$myrow["id"]){
                    echo "selected="selected""; 
                }
            }?> ><?php echo $myrow["name"];?></option>
        <?php
            }while($myrow=mysql_fetch_array($query));
        }?>
        </select></td>
        </tr>
        <tr>
            <td>市级名称:</td>
                <td> 
            <?php if(@$_GET["pid"]!="") { ?>
                <select name="hnthdl_area1" onChange="selecttown(this.value);">
                    <option value="请选择" selected="selected">请选择</option>
            <?php
              	$query=mysql_query("select * from hnthdl_area where reid='".$_GET["pid"]."'");
                if($query==true){
              		while($myrow1=mysql_fetch_array($query)){?>
                	<option value="<?php echo $myrow1["id"];?>"
          	<?php
         	    if(@$_SESSION["cid"]!=""){
                  if(@$_SESSION["cid"]==$myrow1["id"]){
                  echo "selected="selected"";
              }
           }?>><?php echo $myrow1["name"];?></option>
           <?php }}?>
            </select>
          <?php }  ?>  </td>
        </tr>
             <tr>
               <td>县/镇级名称:</td>
               <td>
        <?php if(@$_GET["cid"]!=""){ ?>
        <select name="hnthdl_area1">     
        <?php 
        $query=mysql_query("select * from hnthdl_area where reid='".$_GET["cid"]."'");
        if($query==true){
           while($myrow1=mysql_fetch_array($query)){           ?>
           <option   value="<?php echo $myrow1["id"];?>"><?php echo $myrow1["name2"];?></option>
           <?php }}?>
        </select>
        <?php  } ?> </td>
         </tr>
         </table>   
    </form> 
</body>
</html>

由于数据库文件二级

输出当前时间的js脚本

 <script language=JavaScript>
   today=new Date();
   // alert(today);
   function initArray(){
	   this.length=initArray.arguments.length
	   for(var i=0;i<this.length;i++)
	   		this[i+1]=initArray.arguments[i]
	   }
   var d=new initArray(
     "星期一",
     "星期二",
     "星期三",
     "星期四",
     "星期五",
     "星期六",
     "星期日"
     );
document.write(
     "<font> ",
     	today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日","  ",d[today.getDay()],
	"</font>" 
  ); 
</script> 
原文地址:https://www.cnblogs.com/aten/p/8992331.html