首頁 後端開發 php教程 OfficeXP_menu过程版_PHP教程

OfficeXP_menu过程版_PHP教程

Jul 13, 2016 pm 05:24 PM
endif key menu 定義 過程

<?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;
?>
登入後複製


本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

iOS 17:如何在待機模式下變更iPhone時鐘樣式 iOS 17:如何在待機模式下變更iPhone時鐘樣式 Sep 10, 2023 pm 09:21 PM

待機是一種鎖定螢幕模式,當iPhone插入充電器並以水平(或橫向)方向定位時啟動。它由三個不同的螢幕組成,其中一個是全螢幕時間顯示。繼續閱讀以了解如何變更時鐘的樣式。 StandBy的第三個畫面顯示各種主題的時間和日期,您可以垂直滑動。某些主題也會顯示其他訊息,例如溫度或下一個鬧鐘。如果您按住任何時鐘,則可以在不同的主題之間切換,包括數位、類比、世界、太陽能和浮動。 Float以可自訂的顏色以大氣泡數字顯示時間,Solar具有更多標準字體,具有不同顏色的太陽耀斑設計,而World則透過突出顯示世界地

最新可用的win7旗艦版金鑰2021版 最新可用的win7旗艦版金鑰2021版 Jul 08, 2023 pm 02:37 PM

啟動win7旗艦版系統的方法主要是透過win7啟動碼或win7啟動工具,一般正版的win7啟動碼是需要花錢的,那麼在哪裡有免費可用的win7旗艦版金鑰呢?今天小編就跟大家分享些最新可用的win7旗艦版金鑰用來啟動系統。一、win7旗艦版活化金鑰神key:FJGCP-4DFJD-GJY49-VJBQ7-HYRR2VQ3PY-VRX6D-CBG4J-8C6R2-TCVBD2Y4WT-DHTBF-Q6MMK-KYK6X-VKM6G342-V

SQL中的identity屬性是什麼意思? SQL中的identity屬性是什麼意思? Feb 19, 2024 am 11:24 AM

SQL中的Identity是什麼,需要具體程式碼範例在SQL中,Identity是一種用於產生自增數字的特殊資料類型,它常用於唯一識別表中的每一行資料。 Identity欄位通常與主鍵列搭配使用,可確保每筆記錄都有獨一無二的識別碼。本文將詳細介紹Identity的使用方式以及一些實際的程式碼範例。 Identity的基本使用方式在建立表格時,可以使用Identit

SpringBoot怎麼監聽redis Key變化事件 SpringBoot怎麼監聽redis Key變化事件 May 26, 2023 pm 01:55 PM

一、功能概覽鍵空間通知使得客戶端可以透過訂閱頻道或模式,來接收那些以某種方式改變了Rediskey變化的事件。所有修改key鍵的指令。所有接收到LPUSHkeyvalue[value…]指令的鍵。 db資料庫中所有已過期的鍵。活動透過Redis的訂閱與發布功能(pub/sub)來分發,因此所有支援訂閱與發布功能的用戶端都可以在無須做任何修改的情況下,直接使用按鍵空間通知功能。因為Redis目前的訂閱與發布功能採取的是發送即忘(fireandforget)策略,所以如果你的程

短視頻的定義是什麼 短視頻的定義是什麼 Dec 23, 2020 pm 02:56 PM

短影片的定義是指在各種新媒體平台上播放的、適合在移動狀態和短時休閒狀態下觀看的、高頻推送的視頻內容,一般是在互聯網新媒體上傳播的時長在5分鐘以內的影片;內容融合了技能分享、幽默搞怪、時尚潮流、社會熱點、街頭採訪、公益教育、廣告創意、商業客製化等主題。短影片有著生產流程簡單、製作門檻低、參與性強等特質。

MySQL 複合主鍵的定義與作用 MySQL 複合主鍵的定義與作用 Mar 15, 2024 pm 05:18 PM

MySQL中的複合主鍵是指表中由多個欄位組合而成的主鍵,用來唯一標識每筆記錄。與單一主鍵不同的是,複合主鍵由多個欄位的值組合在一起形成。在建立表格的時候,可以透過指定多個欄位為主鍵來定義複合主鍵。為了示範複合主鍵的定義與作用,我們先建立一個名為users的表,其中包含了id、username和email這三個字段,其中id是自增主鍵,user

什麼是Discuz? Discuz的定義與功能介紹 什麼是Discuz? Discuz的定義與功能介紹 Mar 03, 2024 am 10:33 AM

《探索Discuz:定義、功能及程式碼範例》隨著網路的快速發展,社群論壇已成為人們獲取資訊、交流觀點的重要平台。在眾多的社群論壇系統中,Discuz作為國內較知名的一種開源論壇軟體,備受廣大網站開發者和管理員的青睞。那麼,什麼是Discuz?它又有哪些功能,能為我們的網站提供怎樣的幫助呢?本文將對Discuz進行詳細介紹,並附上具體的程式碼範例,幫助讀者更

如何在 Microsoft Word 中製作自訂邊框 如何在 Microsoft Word 中製作自訂邊框 Nov 18, 2023 pm 11:17 PM

想讓你的學校計畫的頭版看起來令人興奮嗎?沒有什麼比工作簿首頁上的漂亮、優雅的邊框更能使其從其他提交中脫穎而出了。但是,MicrosoftWord中的標準單行邊框已經變得非常明顯和無聊。因此,我們展示了在MicrosoftWord文件中建立和使用自訂邊框的步驟。如何在MicrosoftWord中製作自訂邊框建立自訂邊框非常容易。但是,您將需要一個邊界。步驟1–下載自訂邊框網路上有大量的免費邊界。我們已經下載了一個這樣的邊框。步驟1–在Internet上搜尋自訂邊框。或者,您可以轉到剪貼

See all articles