OfficeXP menu(過程版)

發表于:2007-07-14來源:作者:點擊數: 標簽:
? php /** * 仿Office XP 風格的左邊版面列表 * -------------------------------------------------------------------------------- * blood 于 2/19/2002 4:47:11 PM 加貼在 Visual Basic * * 徐祖寧(嘮叨) 移植于 2/28/2002 * 更正部分錯誤 * */ if($key
<?php
/**
* 仿OfficeXP風格的左邊版面列表    
* --------------------------------------------------------------------------------
* blood 于 2/19/2002 4:47:11 PM 加貼在 Visual Basic
*
* 徐祖寧(嘮叨) 移植于 2/28/2002
* 更正部分錯誤
*
*/

if($key == ""):
echo <<<EOD
<HTML>
<HEAD>
<TITLE>Menu Sample</TITLE>
<SCRIPT LANGUAGE="JavaScript">
if (window != top) top.location.href = location.href;
</SCRIPT>
</HEAD>
  <FRAMESET cols="161,*">        
    <FRAME MARGINWIDTH="0" SRC="$PHP_SELF?key=menu" NAME="menu" SCROLLING=no NORESIZE>
    <FRAME  MARGINWIDTH="0" SRC="$PHP_SELF?key=about" NAME="main" scrolling=auto NORESIZE>
  </FRAMESET>
</HTML>
EOD;
endif;

if($key == "menu"):
/**
*
* $MenuOn                      定義分類菜單數目
* $MenuBackColor               定義分類菜單背景顏色
* $MenuFontSize                定義分類菜單字體
* $MenuBarHeight               定義分類菜單高度
* $ItemTextColor               定義分類菜單項目文字顏色
* $ItemBackColor               定義分類菜單項目背景顏色
* $TopMenuHeight               定義分類菜單與頂部的間距
* $SelectedItemDarkBorder      定義分類菜單項目在鼠標移動到上面時的暗邊框顏色
* $SelectedItemLightBorder     定義分類菜單項目在鼠標移動到上面時的亮邊框顏色
* $SelectedItemBackgroundColor 定義分類菜單項目在鼠標移動到上面時的背景顏色
* $menuSubSectionBackColor     定義二級菜單背景顏色
* $menuSubSectionFontColor     定義二級菜單菜單字體顏色
* $defTarget                   定義菜單項目超連接默認目標框架
*/
$TopMenuHeight = 0;           //設置分類菜單與頂部的間距
$MenuBarHeight = 20;          //設置分類菜單高度
$MenuFontSize = "9pt";            //設置菜單字體大小

//我們使用仿Office XP風格的外觀,也可以使用普通外觀。
$menu_mode = false;

if($menu_mode) {
  //普通菜單外觀
  $MenuBackColor = "lightgrey";             //設置背景顏色
  $ItemBackColor = "#7f7f7f";               //設置菜單項目背景色
  $ItemTextColor = "#ffffff";               //設置菜單項目文字顏色
  $SelectedItemDarkBorder = "#ffffff";      //設置菜單項目在鼠標移動到上面時的暗邊框顏色
  $SelectedItemLightBorder = "#000000";     //設置菜單項目在鼠標移動到上面時的亮邊框顏色
  $SelectedItemBackgroundColor = "";        //設置菜單項目在鼠標移動到上面時的背景顏色
  $menuSubSectionBackColor = "lightgrey";   //設置二級菜單背景顏色
  $menuSubSectionFontColor="black";          //設置二級菜單字體顏色
}else {
  //仿Office XP風格外觀
  $MenuBackColor = "lightgrey";             //設置背景顏色
  $ItemBackColor = "lightgrey";             //設置菜單項目背景色
  $ItemTextColor = "#000000";               //設置菜單項目文字顏色
  $SelectedItemDarkBorder = "#08246B";      //設置菜單項目在鼠標移動到上面時的暗邊框顏色
  $SelectedItemLightBorder = "#08246B";     //設置菜單項目在鼠標移動到上面時的亮邊框顏色
  $SelectedItemBackgroundColor = "#B5BED6"; //設置菜單項目在鼠標移動到上面時的背景顏色
  $menuSubSectionBackColor = "darkgray";    //設置二級菜單背景顏色
  $menuSubSectionFontColor = "black";       //設置二級菜單字體顏色
}
$defTarget = "main";    //設置菜單項目超連接默認目標框架

echo <<<EOD
<style>
td { font-size: $MenuFontSize; font-family:"Verdana", "Arial", "宋體"; }
</style>
<body leftmargin=0 topmargin=0 rightmargin=0 bgcolor="$MenuBackColor">
EOD;

$menuOn = 0;             //對菜單數目初始化

/**
* 繪制菜單方法:
* menuStartSection($Seq, $Label)
*   制作分類菜單
*   $Seq = 分類菜單序列號,使用菜單序列號控制啟動是顯示順序
*   $Label = 分類菜單標題
* menuAddItem($Label, $Description, $URL, $Target="")
*   制作菜單項目
*   $Label = 項目標題
*   $Description = 項目簡介
*   $URL = 超連接地址
*   $Target = 超連接目標框架,默認為$defTarget
* menuAddSubSection($Label)
*   制作二級分類菜單。
*   $Label = 二級分類菜單標題
* menuAddSubSectionLine()
*   制作項目分割線,使用高度為2的圖片
* menuEndSection()
*   分類菜單結束
* menuSectionAsItem($Label, $Description, $URL, $Target="")
*   制作帶超連接的分類菜單,類似菜單項目,可以直接使用
*   $Label = 分類菜單標題
*   $Description = 分類菜單簡介
*   $URL = 超連接地址
*   $Target = 超連接目標框架,默認為$defTarget
*/

/**
* 函數定義
*/
function menuAddItem($itemLabel, $StatusText, $URL, $target="") {
  global $defTarget,
         $SelectedItemDarkBorder,
         $SelectedItemLightBorder,
         $ItemTextColor,
         $SelectedItemBackgroundColor,
         $MenuFontSize ;
  if($target == "") $target = $defTarget;
  $URL = rawurldecode($URL);
  echo <<<EOD

<tr><td width="100%" align=left style="cursor:hand;" title="$StatusText" onmouseover="this.borderColorDark='$SelectedItemDarkBorder';
this.borderColorLight='$SelectedItemLightBorder';this.style.backgroundColor='$SelectedItemBackgroundColor';
this.style.color='black';status='$StatusText';" onmouseout="this.borderColorDark='';this.borderColorLight='';
this.style.backgroundColor='';status='';" onclick="window.open('$URL','$target');">
<font color="$ItemTextColor">$itemLabel</font></td></tr>
EOD;
}

function menuAddSubSection($ItemLabel) {
  global $menuSubSectionBackColor,
         $MenuFontSize,
         $menuSubSectionFontColor;
  echo <<<EOD

<tr bgcolor="$menuSubSectionBackColor"><td align=center width="100%"><font color="$menuSubSectionFontColor">
$ItemLabel</font></td></tr>
EOD;
}

function menuAddSubSectionLine() {
  echo <<<EOD

<tr vAlign="center">
  <td align=center width="100%" height="2" bgcolor="white">
    <table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
     <tr vAlign="center" height="2">
       <td bgcolor="white"></td>
     </tr>
    </table>
  </td>
</tr>
EOD;
}

function menuSectionAsItem($SectionSeq, $SectionName, $SectionDesc, $URL, $target="") {
  global $defTarget,
         $menuBackColor,
         $MenuBarHeight,
         $MenuFontSize;
  if($target == "") $target = $defTarget;
  $URL = rawurldecode($URL);
  $mh = $MenuBarHeight-2;
  echo <<<EOD

<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr vAlign="center" height="1">
  <td bgcolor="white"></td>
</tr>
</table>
<table bgcolor="$menuBackColor" border=1 cellspacing=0 cellpadding=0 bordercolor="$menuBackColor" width="100%" height="Smh">
<tr height="100%" vAlign="center">
  <td border=3 vAlign="middle" width="100%" height="100%" bordercolordark=lightgrey bordercolorlight=lightgrey align=center style="cursor:hand;" title="$SectionDesc" onmouseover="status='$SectionDesc';" onmouseout="status='';" onclick="window.open('$URL','$target');"><font color="#000000">$SectionName</font></td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
  <td bgcolor="Black"></td>
</tr>
</table>
EOD;
}

function menuStartSection($SectionSeq, $SectionName) {
  global $menuBackColor,
         $MenuBarHeight,
         $MenuFontSize,
         $menuSection,
         $ItemBackColor;
  $mh = $MenuBarHeight-2;
  echo <<<EOD

<table bgcolor="$menuBackColo" border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
  <td bgcolor="white"></td>
</tr>
</table>
<table bgcolor="$menuBackColor" border=1 cellspacing=0 cellpadding=0 bordercolor="$menuBackColor" width="100%" height="$mh">
<tr vAlign="center" height="100%">
  <td nowrap border=3 width="100%" height="100%" bordercolordark=lightgrey bordercolorlight=lightgrey align=center style="cursor:hand;" title="$SectionName" onmouseover="status='$SectionName';" onmouseout="status='';" onclick="StartSection(menuSection$SectionSeq);">$SectionName</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="1">
<tr height="1">
  <td bgcolor="Black"></td>
</tr>
</table>
<div name=menuSection$SectionSeq id=menuSection$SectionSeq style="display:'none';overflow:hidden; height:1px;marginRight:0px;">
<table bgcolor=$ItemBackColor style="marginRight=0px;" border=1 cellspacing=0 cellpadding=0 bordercolor="$ItemBackColor" width="100%">
EOD;
}

function menuEndSection() {
  echo <<<EOD

</table>
</div>
EOD;
}

/**
* 創建菜單
*/
  menuStartSection(2, "代碼世界");
  menuAddItem("Joy ASP", "歡迎訪問Joy ASP", "$PHP_SELF?key=page&id=Joy ASP");
  menuAddItem("Java 世界", "歡迎訪問Java 世界", "$PHP_SELF?key=page&id=Java 世界");
  menuAddItem("DotNet 時代", "歡迎訪問DotNet 時代", "$PHP_SELF?key=page&id=DotNet 時代");
  menuAddItem("Visual Basic", "歡迎訪問Visual Basic", "$PHP_SELF?key=page&id=Visual Basic");
  menuAddItem("Delphi", "歡迎訪問Delphi", "$PHP_SELF?key=page&id=Delphi");
  menuEndSection();

  menuStartSection(3, "開心一刻");
  menuAddItem("傳統笑話", "傳統笑話", "$PHP_SELF?key=page&id=傳統笑話");
  menuAddItem("近代笑話", "近代笑話", "$PHP_SELF?key=page&id=近代笑話");
  menuAddSubSection("兒童類");
  menuAddItem("校園笑話", "校園笑話", "$PHP_SELF?key=page&id=校園笑話");
  menuAddItem("幼兒笑話", "幼兒笑話", "$PHP_SELF?key=page&id=幼兒笑話");
  menuAddItem("少年笑話", "少年笑話", "$PHP_SELF?key=page&id=少年笑話");
  menuAddSubSectionLine();
  menuAddItem("中學時代笑話", "中學時代笑話", "$PHP_SELF?key=page&id=中學時代笑話");
  menuAddSubSection("成人笑話");
  menuAddItem("帶顏色的笑話", "帶顏色的笑話", "$PHP_SELF?key=page&id=帶顏色的笑話");
  menuAddItem("笑話林", "笑話林", "$PHP_SELF?key=page&id=笑話林");
  menuEndSection();

  menuSectionAsItem(3, "菜單簡介", "菜單簡介", "$PHP_SELF?key=about");

  menuStartSection(1, "個人收藏夾");
  menuAddItem("DotNet 時代", "歡迎訪問DotNet 時代", "$PHP_SELF?key=page&id=DotNet 時代");
  menuEndSection();

  // 將個人收藏夾定為啟動菜單
  $menuOn = 4;

/**
* 輸出javascript腳本
*/
echo <<<EOD

<script language=javascript>
var AvailHeight       // 定義可利用的高度
var LastSection       // 定義將要打開的菜單關閉
var ThisSection       // 定義當前需要打開的菜單
var timerDelay=15     // 定義并設置延時
var menuActive=false  // 測定當前活動的菜單
var VisibleHeight     // 定義顯示高度,確定是否顯示滾動條
var AniRatio          // 定義菜單顯示滑動的速度

function getSizing() {
  // 菜單打開時得到的可利用的高度
  AvailHeight=document.body.clientHeight-$TopMenuHeight-($MenuBarHeight*$menuOn)
  if(AvailHeight<=0) {
    LastSection.style.display='none';
  }else {
    // 改變菜單顯示滑動速度的比率
    AniRatio=0.75;                          // 設定速度
    if(AvailHeight>200) {AniRatio=0.667;}  
    if(AvailHeight>500) {AniRatio=0.5;}    // 根據可利用高度調整速度
    LastSection.style.height=AvailHeight;
    LastSection.style.overflow='visible';
    LastSection.style.display='';
    VisibleHeight=parseInt(LastSection.clientHeight);
    if(VisibleHeight>AvailHeight) {LastSection.style.overflow='auto';}else{LastSection.style.overflow='hidden';};
  }
}

function slideMenu() {
  // 菜單滑動函數
  if(parseInt(LastSection.style.height)>1) {
    LastSection.style.height=parseInt(parseInt(LastSection.style.height)*AniRatio);
    ThisSection.style.height=AvailHeight-parseInt(LastSection.style.height);
    var movetimer=setTimeout("slideMenu()",timerDelay)  ;
  }else {
    // 完成菜單滑動,顯示新打開的菜單,隱藏前面以打開的菜單
    LastSection.style.display='none';
    ThisSection.style.height=AvailHeight;
    menuActive=false;
    if (VisibleHeight>AvailHeight) {ThisSection.style.overflow='auto';};
    ThisSection.style.marginRight=0;
    LastSection=ThisSection;
    clearTimeout(movetimer);
  }
}

function StartSection(theSection) {
  // 開始滑動菜單,檢測是否對菜單進行單擊
  if(menuActive==false) {
    if(LastSection!=theSection) {
      menuActive=true;
      ThisSection=theSection;
      LastSection.style.overflow='hidden';
      ThisSection.style.overflow='visible';
      ThisSection.style.display='';
      VisibleHeight=parseInt(ThisSection.clientHeight);
      ThisSection.style.overflow='hidden';
      ThisSection.style.display='none';
      ThisSection.style.height=1;
      LastSection.style.height=AvailHeight-1;
      LastSection.style.display='';
      ThisSection.style.display='';
      slideMenu()
    }
  }
}

window.onresize=getSizing
// 啟動時打開默認的序號為第一個的菜單
LastSection=document.all.menuSection1;
LastSection.style.display='';
getSizing();
</script>
</body>
EOD;

endif;


if($key == "page"):
echo <<<EOD
<style>
body { font-size: 9pt; font-family:"Verdana", "Arial", "宋體"; }
</style>
<body>
<center>
<br>
<br>
歡迎訪問 $id
</center>
</body>
EOD;
endif;

if($key == "about"):
echo <<<EOD
<style>
body { font-size: 9pt; font-family:"Verdana", "Arial", "宋體"; }
</style>
<body>
<center>
<br>
<br>
關于此菜單
<br>
<br>
說明,此菜單程序只能使用在IE 5以上的版本使用,NetSpace下不能使用,推薦使用IE 6正式中文版
</center>
</body>
EOD;
endif;
?>

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97