PHP网页设计BBS(php & mysql)完全版(五)
刚开始因为习惯于ASP格式的写法,总是在这些方面出现问题,自己还总是找不到问题所在,这就提醒了自己,在写代码的时候一定要认真,不能粗心地老是少个“;”或者字母大小写不分,要不然很可能找半天都找不到错误。 //上面为menu_comment.jsfunction fwLoadMenus() {
if (window.fw_menu_0) return;
window.fw_menu_0 = new Menu("root",92,20,"Verdana, Arial, Helvetica, sans-serif",12,"#6666ff","#ffffff","#FF9999","#6666ff");
fw_menu_0.addMenuItem("Javascript","window.open('left.php', '_self');");
fw_menu_0.addMenuItem("Css疾速入门","window.open('left.php', '_self');");
fw_menu_0.addMenuItem("JS在线资本","window.open('left.php', '_self');");
fw_menu_0.addMenuItem("相干服装论坛","window.open('php3.php?part=4&&p=1', '_self');");
fw_menu_0.fontWeight="solid";
fw_menu_0.hideOnMouseOut=true;
window.fw_menu_1 = new Menu("root",92,20,"Verdana, Arial, Helvetica, sans-serif",12,"#6666ff","#ffffff","#FF9999","#6666ff");
fw_menu_1.addMenuItem("Dreamwaver","window.open('left.php', '_self');");
fw_menu_1.addMenuItem("Firework","window.open('left.php', '_self');");
fw_menu_1.addMenuItem("Flash入门","window.open('left.php', '_self');");
fw_menu_1.addMenuItem("Html教程","window.open('left.php', '_self');");
fw_menu_1.addMenuItem("相干服装论坛","window.open('php3.php?part=3&&p=1', '_self');");
fw_menu_1.fontWeight="solid";
fw_menu_1.hideOnMouseOut=true;
window.fw_menu_2 = new Menu("root",86,20,"Verdana, Arial, Helvetica, sans-serif",12,"#6666ff","#ffffff","#FF9999","#6666ff");
fw_menu_2.addMenuItem("Mysql引见","window.open('mysql1.php', '_self');");
fw_menu_2.addMenuItem("在线下载","window.open('mysql2.php', '_self');");
fw_menu_2.addMenuItem("进修教程","window.open('mysql4a.php', '_self');");
fw_menu_2.addMenuItem("Mysql服装论坛","window.open('php3.php?part=2&&p=1', '_self');");
fw_menu_2.fontWeight="solid";
fw_menu_2.hideOnMouseOut=true;
window.fw_menu_3 = new Menu("root",76,20,"Verdana, Arial, Helvetica, sans-serif",12,"#6666ff","#ffffff","#FF9999","#6666ff");
fw_menu_3.addMenuItem("装置设置装备摆设","window.open('php1.php?id1=1&&id2=1', '_self');");
fw_menu_3.addMenuItem("法式代码","window.open('php2.php?id1=2&&id2=1', '_self');");
fw_menu_3.addMenuItem("进修教程","window.open('php4.php?id1=4&&id2=1', '_self');");
fw_menu_3.addMenuItem("PHP服装论坛","window.open('php3.php?part=1&&p=1', '_self');");
fw_menu_3.fontWeight="solid";
fw_menu_3.hideOnMouseOut=true;
fw_menu_3.writeMenus();
} // fwLoadMenus()
//上面是fw_menu.js
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) {
this.version = "990702 ";
this.type = "Menu";
this.menuWidth = mw;
this.menuItemHeight = mh;
this.fontSize = fs||12;
this.fontWeight = "plain";
this.fontFamily = fnt||"arial,helvetica,verdana,sans-serif";
this.fontColor = fclr||"#000000";
this.fontColorHilite = fhclr||"#ffffff";
this.bgColor = "#555555";
this.menuBorder = 1;
this.menuItemBorder = 1;
this.menuItemBgColor = bg||"#cccccc";
this.menuLiteBgColor = "#ffffff";
this.menuBorderBgColor = "#777777";
this.menuHiliteBgColor = bgh||"#000084";
this.menuContainerBgColor = "#cccccc";
this.childMenuIcon = "arrows.gif";
this.items = new Array();
this.actions = new Array();
this.childMenus = new Array();
this.hideOnMouseOut = true;
this.addMenuItem = addMenuItem;
this.addMenuSeparator = addMenuSeparator;
this.writeMenus = writeMenus;
this.FW_showMenu = FW_showMenu;
this.onMenuItemOver = onMenuItemOver;
this.onMenuItemAction = onMenuItemAction;
this.hideMenu = hideMenu;
this.hideChildMenu = hideChildMenu;
if (!window.menus) window.menus = new Array();
this.label = label || "menuLabel" + window.menus.length;
window.menus = this;
window.menus = this;
if (!window.activeMenus) window.activeMenus = new Array();
}
function addMenuItem(label, action) {
this.items = label;
this.actions = action;
}
function addMenuSeparator() {
this.items = "separator";
this.actions = "";
this.menuItemBorder = 0;
}
// For NS6.
function FIND(item) {
if (document.all) return(document.all);
if (document.getElementById) return(document.getElementById(item));
return(false);
}
function writeMenus(container) {
if (window.triedToWriteMenus) return;
if (!container && document.layers) {
window.delayWriteMenus = this.writeMenus;
var timer = setTimeout('delayWriteMenus()', 250);
container = new Layer(100);
clearTimeout(timer);
} else if (document.all || document.hasChildNodes) {
document.writeln('<SPAN ID="menuContainer"></SPAN>');
container = FIND("menuContainer");
}
window.fwHideMenuTimer = null;
if (!container) return;
window.triedToWriteMenus = true;
container.isContainer = true;
container.menus = new Array();
for (var i=0; i<window.menus.length; i++)
container.menus = window.menus;
window.menus.length = 0;
var countMenus = 0;
var countItems = 0;
var top = 0;
var content = '';
var lrs = false;
var theStat = "";
var tsc = 0;
if (document.layers) lrs = true;
for (var i=0; i<container.menus.length; i++, countMenus++) {
var menu = container.menus;
if (menu.bgImageUp) {
menu.menuBorder = 0;
menu.menuItemBorder = 0;
}
if (lrs) {
var menuLayer = new Layer(100, container);
var lite = new Layer(100, menuLayer);
lite.top = menu.menuBorder;
lite.left = menu.menuBorder;
var body = new Layer(100, lite);
body.top = menu.menuBorder;
body.left = menu.menuBorder;
} else {
content += ''+
'<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:1;left:10;top:'+ (i * 100) +';visibility:hidden;">n'+
'<DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;z-index:1;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;" >n'+
' <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">n'+
'';
}
var x=i;
for (var i=0; i<menu.items.length; i++) {
var item = menu.items;
var childMenu = false;
var defaultHeight = menu.fontSize+6;
var defaultIndent = menu.fontSize;
if (item.label) {
item = item.label;
childMenu = true;
}
menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
menu.menuItemIndent = menu.menuItemIndent || defaultIndent;
var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';';
if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';
if (document.all)
itemProps += 'font-size:' + menu.fontSize + ';" menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
var dClose = '</DIV>'
if (menu.bgImageUp) {
menu.menuBorder = 0;
menu.menuItemBorder = 0;
dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="background:url('+menu.bgImageUp+');position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
if (document.layers) {
dTag = '<LAYER BACKGROUND="'+menu.bgImageUp+'" ID="menuItem'+ countItems +'" TOP="'+ (i * menu.menuItemHeight) +'" style="' + itemProps +'">';
dClose = '</LAYER>';
}
}
var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:1;';
if (lrs) {
textProps +=itemProps;
dTag = "";
dClose = "";
}
var dText = '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">'+ item +' </DIV>n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:1;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +' </DIV>';
if (item == "separator") {
content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>n' + dClose);
} else if (childMenu) {
content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;"><IMG SRC="'+ menu.childMenuIcon +'"></DIV>n' + dClose);
} else {
content += ( dTag + dText + dClose);
}
if (lrs) {
l.document.open("text/html");
l.document.writeln(content);
l.document.close();
content = '';
theStat += "-";
tsc++;
if (tsc > 50) {
tsc = 0;
theStat = "";
}
status = theStat;
}
countItems++;
}
if (lrs) {
// focus layer
var focusItem = new Layer(100, body);
focusItem.visiblity="hidden";
focusItem.document.open("text/html");
focusItem.document.writeln(" ");
focusItem.document.close();
} else {
content += ' <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" > </DIV>n';
content += ' </DIV>n</DIV>n</DIV>n';
}
i=x;
}
if (document.layers) {
container.clip.width = window.innerWidth;
container.clip.height = window.innerHeight;
container.onmou搜索引擎优化ut = mou搜索引擎优化utMenu;
container.menuContainerBgColor = this.menuContainerBgColor;
for (var i=0; i<container.document.layers.length; i++) {
proto = container.menus;
var menu = container.document.layers;
container.menus.menuLayer = menu;
container.menus.menuLayer.Menu = container.menus;
container.menus.menuLayer.Menu.container = container;
var body = menu.document.layers.document.layers;
body.clip.width = proto.menuWidth || body.clip.width;
body.clip.height = proto.menuHeight || body.clip.height;
for (var n=0; n<body.document.layers.length-1; n++) {
var l = body.document.layers;
l.Menu = container.menus;
l.menuHiliteBgColor = proto.menuHiliteBgColor;
l.document.bgColor = proto.menuItemBgColor;
l.saveColor = proto.menuItemBgColor;
l.onmou搜索引擎优化ver = proto.onMenuItemOver;
l.onclick = proto.onMenuItemAction;
l.action = container.menus.actions;
l.focusItem = body.document.layers;
l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent;
l.clip.height = proto.menuItemHeight || l.clip.height;
if (n>0) l.top = body.document.layers.top + body.document.layers.clip.height + proto.menuItemBorder;
l.hilite = l.document.layers;
if (proto.bgImageUp) l.background.src = proto.bgImageUp;
l.document.layers.isHilite = true;
if (l.document.layers.id.indexOf("menuSeparator") != -1) {
l.hilite = null;
l.clip.height -= l.clip.height / 2;
l.document.layers.document.bgColor = proto.bgColor;
l.document.layers.clip.width = l.clip.width -2;
l.document.layers.clip.height = 1;
l.document.layers.document.bgColor = proto.menuLiteBgColor;
l.document.layers.clip.width = l.clip.width -2;
l.document.layers.clip.height = 1;
l.document.layers.top = l.document.layers.top + 1;
} else if (l.document.layers.length > 2) {
l.childMenu = container.menus.items.menuLayer;
l.document.layers.left = l.clip.width -13;
l.document.layers.top = (l.clip.height / 2) -4;
l.document.layers.clip.left += 3;
l.Menu.childMenus = l.childMenu;
}
}
body.document.bgColor = proto.bgColor;
body.clip.width= l.clip.width +proto.menuBorder;
body.clip.height = l.top + l.clip.height
另外要叮嘱各位的是,抵御诱惑,ASP/PHP/JSP/.NET的对比也许会让你无所适从,你也许学了一半PHP,又开始打C#的主意,或者有人说JAVA很强,这个时候的你绝对不能动摇,哪怕你真想学。 如果你可以写完像留言板这样的程序,那么你可以去一些别人的代码了, 学好程序语言,多些才是王道,写两个小时代码的作用绝对超过看一天书,这个我是深有体会(顺便还能练打字速度)。 Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81 使用 jquery 等js框架的时候,要随时注意浏览器的更新情况,不然很容易发生框架不能使用。 开发工具也会慢慢的更专业,每个公司的可能不一样,但是zend studio是个大伙都会用的。 遇到出错的时候,我经常把错误信息直接复制到 google的搜索栏,一般情况都是能搜到结果的,不过有时候会搜出来一大片英文的出来,这时候就得过滤一下,吧中文的弄出来,挨着式方法。 使用 jquery 等js框架的时候,要随时注意浏览器的更新情况,不然很容易发生框架不能使用。 学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql 写的比较杂,因为我也是个新手,不当至于大家多多指正。 实践是检验自己会不会的真理。 我学习了一段时间后,我发现效果并不好(估计是我自身的问题)。因为一个人的精力总是有限的,同时学习这么多,会导致每个的学习时间都得不到保证。 说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。 因为blog这样的可以让你接触更多要学的知识,可以接触用到类,模板,js ,ajax Ps:以上纯属原创,如有雷同,纯属巧合 不禁又想起那些说php是草根语言的人,为什么认得差距这么大呢。 Ps:以上纯属原创,如有雷同,纯属巧合 对于懒惰的朋友,我推荐php的集成环境xampp或者是wamp。这两个软件安装方便,使用简单。但是我还是强烈建议自己动手搭建开发环境。 为了以后维护的方便最好是代码上都加上注释,“予人方便,自己方便”。此外开发文档什么的最好都弄齐全。我觉得这是程序员必备的素质。虽然会消耗点很多的时间。但是确实是非常有必要的。 在我安装pear包的时候老是提示,缺少某某文件,才发现 那群extension 的排列是应该有一点的顺序,而我安装的版本的排序不是正常的排序。没办法我只好把那群冒号加了上去,只留下我需要使用的扩展。
页:
[1]