电信主站 网通分站
购买流程 付款方式 常见问题 在线提问 续租服务 购物车
用户名: 密 码: 忘记密码?
首 页
域名注册
虚拟主机
双线主机
服务器租用
VPS主机
企业邮局
代理专区
客服中心
虚拟主机行业资讯 虚拟主机评测对比 互联网最新动态 技术学院 站长资讯 在线教程 网站运营
搜索优化 服务器 网络编程 图形图象 站长之家 网页制作 操作系统
冲浪宝典 软件教学 视频通信 办公软件 邮件系统 网络安全 认证考试
您当前位置:西部数码->资讯中心-> 在线教程-> PHP
仿OfficeXP风格的左边版面列表-PHP教程,PHP技巧
作者:网友供稿 点击:9
  西部数码-全国虚拟主机10强!20余项虚拟主机管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!虚拟主机可在线rar解压,自动数据恢复设置虚拟目录等.虚拟主机免费赠送访问统计,企业邮局.Cn域名注册10元/年,自助建站480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金!
文章页数:[1] 
<?php
/**
* 仿officexp风格的左边版面列表
* --------------------------------------------------------------------------------
* blood 于 2/19/2002 4:47:11 pm 加贴在 visual basic
*
* 徐祖宁(唠叨) 移植于 3/2/2002
* oop 版
*
*/

class frame {
function run() {
global $php_self;
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;
}
}

class about {
function run() {
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;
}
}

class page {
function run($id1) {
global $id;
echo <<<eod
<style>
body { font-size: 9pt; font-family:"verdana", "arial", "宋体"; }
</style>
<body>
<center>
<br>
<br>
欢迎访问 $id
</center>
</body>
eod;
}
}

class menu {
var $menuon = 0; //定义分类菜单数目
var $menubackcolor = "lightgrey"; //定义分类菜单背景颜色
var $menufontsize = "9pt"; //定义分类菜单字体
var $menubarheight = 20; //定义分类菜单高度
var $itemtextcolor = "#000000"; //定义分类菜单项目文字颜色
var $itembackcolor = "lightgrey"; //定义分类菜单项目背景颜色
var $topmenuheight = 0; //定义分类菜单与顶部的间距
var $selecteditemdarkborder = "#08246b"; //定义分类菜单项目在鼠标移动到上面时的暗边框颜色
var $selecteditemlightborder = "#08246b"; //定义分类菜单项目在鼠标移动到上面时的亮边框颜色
var $selecteditembackgroundcolor = "#b5bed6"; //定义分类菜单项目在鼠标移动到上面时的背景颜色
var $menusubsectionbackcolor = "darkgray"; //定义二级菜单背景颜色
var $menusubsectionfontcolor = "black"; //定义二级菜单菜单字体颜色
var $deftarget = "main"; //定义菜单项目超连接默认目标框架

/**
* menustartsection($seq, $label)
* 制作分类菜单
* $seq = 分类菜单序列号,使用菜单序列号控制启动是显示顺序
* $label = 分类菜单标题
*/
function menustartsection($sectionseq, $sectionname) {
$menubackcolor = $this->menubackcolor;
$menubarheight = $this->menubarheight;
$menufontsize = $this->menufontsize;
$menusection = $this->menusection;
$itembackcolor = $this->itembackcolor;
$mh = $this->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;
}

/**
* menuadditem($label, $description, $url, $target="")
* 制作菜单项目
* $label = 项目标题
* $description = 项目简介
* $url = 超连接地址
* $target = 超连接目标框架,默认为$deftarget
*/
function menuadditem($itemlabel, $statustext, $url, $target="") {
$selecteditemdarkborder = $this->selecteditemdarkborder;
$selecteditemlightborder = $this->selecteditemlightborder;
$selecteditembackgroundcolor = $this->selecteditembackgroundcolor;
$itemtextcolor = $this->itemtextcolor;

if($target == "") $target = $this->deftarget;
$url = $this->buildurl($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;
}

/**
* menuaddsubsection($label)
* 制作二级分类菜单。
* $label = 二级分类菜单标题
*/
function menuaddsubsection($itemlabel) {
$menusubsectionbackcolor = $this->menusubsectionbackcolor;
$menusubsectionfontcolor = $this->menusubsectionfontcolor;
echo <<<eod

<tr bgcolor="$menusubsectionbackcolor">
<td align=center width="100%"><font color="$menusubsectionfontcolor">$itemlabel</font></td>
</tr>
eod;
}

/**
* menuaddsubsectionline()
* 制作项目分割线,使用高度为2的图片
*/
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;
}

/**
* menuendsection()
* 分类菜单结束
*/
function menuendsection() {
echo <<<eod

</table>
</div>
eod;
}

/**
* menusectionasitem($label, $description, $url, $target="")
* 制作带超连接的分类菜单,类似菜单项目,可以直接使用
* $label = 分类菜单标题
* $description = 分类菜单简介
* $url = 超连接地址
* $target = 超连接目标框架,默认为$deftarget
*/
function menusectionasitem($sectionseq, $sectionname, $sectiondesc, $url, $target="") {
$menubackcolor = $this->menubackcolor;
$menubarheight = $this->menubarheight;

if($target == "") $target = $this->deftarget;
$url = $this->buildurl($url);
$mh = $this->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 buildurl($inurl) {
return str_replace(" ","+",$inurl);
}
/**
* 输出javascript脚本
*/
function scriptout() {
$dh = $this->topmenuheight+($this->menubarheight * $this->menuon);
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-$dh
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>
eod;
}

function run() {
global $php_self;
$menufontsize = $this->menufontsize;
$menubackcolor = $this->menubackcolor;
echo <<<eod
<style>
td { font-size: $menufontsize; font-family:"verdana", "arial", "宋体"; }
</style>
<body leftmargin=0 topmargin=0 rightmargin=0 bgcolor="$menubackcolor">
eod;

/**
* 创建菜单
*/
$this->menustartsection(2, "代码世界");
$this->menuadditem("joy asp", "欢迎访问joy asp", "$php_self?key=page&id=joy asp");
$this->menuadditem("java 世界", "欢迎访问java 世界", "$php_self?key=page&id=java 世界");
$this->menuadditem("dotnet 时代", "欢迎访问dotnet 时代", "$php_self?key=page&id=dotnet 时代");
$this->menuadditem("visual basic", "欢迎访问visual basic", "$php_self?key=page&id=visual basic");
$this->menuadditem("delphi", "欢迎访问delphi", "$php_self?key=page&id=delphi");
$this->menuendsection();

$this->menustartsection(3, "开心一刻");
$this->menuadditem("传统笑话", "传统笑话", "$php_self?key=page&id=传统笑话");
$this->menuadditem("近代笑话", "近代笑话", "$php_self?key=page&id=近代笑话");
$this->menuaddsubsection("儿童类");
$this->menuadditem("校园笑话", "校园笑话", "$php_self?key=page&id=校园笑话");
$this->menuadditem("幼儿笑话", "幼儿笑话", "$php_self?key=page&id=幼儿笑话");
$this->menuadditem("少年笑话", "少年笑话", "$php_self?key=page&id=少年笑话");
$this->menuaddsubsectionline();
$this->menuadditem("中学时代笑话", "中学时代笑话", "$php_self?key=page&id=中学时代笑话");
$this->menuaddsubsection("成人笑话");
$this->menuadditem("带颜色的笑话", "带颜色的笑话", "$php_self?key=page&id=带颜色的笑话");
$this->menuadditem("笑话林", "笑话林", "$php_self?key=page&id=笑话林");
$this->menuendsection();

$this->menusectionasitem(3, "菜单简介", "菜单简介", "$php_self?key=about");

$this->menustartsection(1, "个人收藏夹");
$this->menuadditem("dotnet 时代", "欢迎访问dotnet 时代", "$php_self?key=page&id=dotnet 时代");
$this->menuendsection();

// 将个人收藏夹定为启动菜单
$this->menuon = 4;
$this->scriptout();
echo "</body>n";
}
}

class application {
var $frame;
var $menu;
var $page;
var $about;
function application() {
$this->frame = new frame;
$this->about = new about;
$this->page = new page;
$this->menu = new menu;
}
function run($key,$id="") {
switch($key) {
case "menu":
$this->menu->run();
break;
case "page":
$this->page->run($id);
break;
case "about":
$this->about->run();
break;
default:
$this->frame->run();
}
}
}
?>
<?php
/** 运行 **/
$app = new application;
$app->run($key,$id);
?>

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
相关主题
文章页数:[1] 
Google
热门文章
·Windows下的PHP5.0安装配制详解-PHP教程,PHP安装
·PHP在XP下IIS和Apache2服务器上的安装-PHP教程,PHP应用
·最近忙于FTP,好站多多!有好多好东东哦!不敢独享!-PHP教程,PHP基础
·PHP 5.0 Pear安装方法-PHP教程,PHP安装
·PHP开发利器-PRADO 1.6(4)-PHP教程,PHP应用
·Sun Sparc Solaris 2.6 Apache-1.3.12+MySQL-3.23.5+PHP-3.0.15 安装记-PHP教程,PHP应用
·php5学习笔记(转)-PHP教程,PHP应用
·APACHE安装笔记-PHP教程,PHP安装
·PHP.MVC的模板标签系统(四)-PHP教程,PHP应用
·PHP.MVC的模板标签系统(二)-PHP教程,PHP应用

最新文章
·PHP源码-利用 QQWry.Dat 实现 IP 地址高效检索
·Php高手带路--问题汇总解答[2]
·PHPQQ编程(2):取QQ在线状态
·php5手动最简安装方法
·福利彩票幸运号码自动生成器
·PHP开发利器-PRADO 1.6
·在Apache 服务器上启用PHP支持
·Windows2000_pro下安装Apache+PHP4+My
·php文件上传的实现
·PHP开发框架的现状和展望




版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
  打印  刷新  关闭
返回首页 |关于我们 | 联系我们 | 付款方式 | 创业联盟 | 虚拟主机 | 资讯中心 | 友情链接 | 网站地图

版权所有 西部数码(www.west263.com)
CopyRight (c) 2002~2006 west263.com all right reserved.
公司地址:四川成都市万和路90号天象大厦4楼 邮编:610031
电话总机:028-86262244 86263048 86263408 86263960 86264018 86267838
售前咨询:总机转201 202 203 204 206 208
售后服务:总机转211 212 213 214
财务咨询:总机转224 223 传真:028-86264041 财务QQ:点击发送消息给对方635483282
售前咨询QQ:点击发送消息给对方2182518 点击发送消息给对方241975952 点击发送消息给对方275026793 点击发送消息给对方408235859
售后服务QQ:点击发送消息给对方17708515 点击发送消息给对方307742704 点击发送消息给对方287976517 点击发送消息给对方363783715
《中华人民共和国增值电信业务经营许可证》编号:川B2-20030065号