Home Backend Development PHP Tutorial OfficeXP_menu process version_PHP tutorial

OfficeXP_menu process version_PHP tutorial

Jul 13, 2016 pm 05:24 PM
endif key menu definition Version process

<?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;
?>
Copy after login


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The latest available win7 ultimate version key 2021 version The latest available win7 ultimate version key 2021 version Jul 08, 2023 pm 02:37 PM

The main method to activate the win7 ultimate system is through win7 activation code or win7 activation tool. Generally, the genuine win7 activation code requires money, so where can I find the free win7 ultimate key? Today I will share with you some of the latest available win7 ultimate keys for activating the system. 1. Win7 Ultimate Edition activation key: FJGCP-4DFJD-GJY49-VJBQ7-HYRR2VQ3PY-VRX6D-CBG4J-8C6R2-TCVBD2Y4WT-DHTBF-Q6MMK-KYK6X-VKM6G342DG-6YJR8-X92GV-V7DCV-P4K279CW99-

iOS 17: How to change iPhone clock style in standby mode iOS 17: How to change iPhone clock style in standby mode Sep 10, 2023 pm 09:21 PM

Standby is a lock screen mode that activates when the iPhone is plugged into the charger and oriented in horizontal (or landscape) orientation. It consists of three different screens, one of which is displayed full screen time. Read on to learn how to change the style of your clock. StandBy's third screen displays times and dates in various themes that you can swipe vertically. Some themes also display additional information, such as temperature or next alarm. If you hold down any clock, you can switch between different themes, including Digital, Analog, World, Solar, and Floating. Float displays the time in large bubble numbers in customizable colors, Solar has a more standard font with a sun flare design in different colors, and World displays the world by highlighting

What does the identity attribute in SQL mean? What does the identity attribute in SQL mean? Feb 19, 2024 am 11:24 AM

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

How SpringBoot monitors redis Key change events How SpringBoot monitors redis Key change events May 26, 2023 pm 01:55 PM

1. Function Overview Keyspace notification allows clients to receive events that modify Rediskey changes in some way by subscribing to channels or patterns. All commands that modify key keys. All keys that received the LPUSHkeyvalue[value…] command. All expired keys in the db database. Events are distributed through Redis's subscription and publishing functions (pub/sub), so all clients that support subscription and publishing functions can directly use the keyspace notification function without any modifications. Because the current subscription and publishing functions of Redis adopt a fireandforget strategy, if your program

What is the definition of short video? What is the definition of short video? Dec 23, 2020 pm 02:56 PM

The definition of short video refers to high-frequency pushed video content that is played on various new media platforms, suitable for viewing on the move and in a short-term leisure state, and is generally spread on new Internet media within 5 minutes. Video; the content combines skills sharing, humor, fashion trends, social hot spots, street interviews, public welfare education, advertising creativity, business customization and other themes. Short videos have the characteristics of simple production process, low production threshold, and strong participation.

The definition and function of MySQL composite primary key The definition and function of MySQL composite primary key Mar 15, 2024 pm 05:18 PM

The composite primary key in MySQL refers to the primary key composed of multiple fields in the table, which is used to uniquely identify each record. Unlike a single primary key, a composite primary key is formed by combining the values ​​of multiple fields. When creating a table, you can define a composite primary key by specifying multiple fields as primary keys. In order to demonstrate the definition and function of composite primary keys, we first create a table named users, which contains three fields: id, username and email, where id is an auto-incrementing primary key and user

What is Discuz? Definition and function introduction of Discuz What is Discuz? Definition and function introduction of Discuz Mar 03, 2024 am 10:33 AM

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

How to make custom borders in Microsoft Word How to make custom borders in Microsoft Word Nov 18, 2023 pm 11:17 PM

Want to make the front page of your school project look exciting? Nothing makes it stand out from other submissions like a nice, elegant border on the homepage of your workbook. However, the standard single-line borders in Microsoft Word have become very obvious and boring. Therefore, we show you the steps to create and use custom borders in Microsoft Word documents. How to Make Custom Borders in Microsoft Word Creating custom borders is very easy. However, you will need a boundary. Step 1 – Download Custom Borders There are tons of free borders on the internet. We have downloaded a border like this. Step 1 – Search the Internet for custom borders. Alternatively, you can go to clipping

See all articles