js+css实现的仿office2003界面
效果图
screen.width-461) window.open('http://bbs.javascript.com.cn/attachment/Mon_0608/10_9458_40785726bd46566.jpg');" src="http://bbs.javascript.com.cn/attachment/Mon_0608/10_9458_40785726bd46566.jpg" border=0>
仿Office2003的工具条
/*----------
舜子制作
Menu java-script Made by PuterJam
E-mail:puterjam@etang.com
-------------*/
var listnum=0;
var menu_height;
var menu_width;
var menu_left;
var menu_top;
var topMar = 1;
var leftMar = -2;
var space = 1;
var isvisible;
function listbox(listname,buttonname,valuename)
{
this.listname=listname
this.buttonname=buttonname
this.valuename=valuename
}
function listaction(obj,action,showlist,scroll,tw)
{
num=obj.id.charAt(obj.id.length-1)
if (!scroll) {scroll=0}
if (!tw) {tw=105}
listbox=eval(lb[num].listname)
listbutton=eval(lb[num].buttonname)
listvalue=eval(lb[num].valuename)
switch (action)
{
case 0:
listbox.className="getlist";listbutton.className="listover"
break;
case 1:
if (listbox.gf=="0")
{listbox.className="lostlist";listbutton.className="menubar"}
break;
case 2:
for (i=0;i parseInt(vDiv.style.left)+vDiv.offsetWidth) ||
(mY parseInt(vDiv.style.top)+vDiv.offsetHeight)) {
vDiv.style.visibility = "hidden";
isvisible = false;
}
}
if (isvisible==false)
{
for (i=0;i
vMnuCode + "
";
menu_height = obj.offsetHeight;
menu_width = obj.offsetWidth;
menu_left = obj.offsetLeft + leftMar+2;
menu_top = obj.offsetTop + topMar + menu_height + space-3;
vParent = obj.offsetParent;
while (vParent.tagName.toUpperCase() != "BODY")
{
menu_left += vParent.offsetLeft;
menu_top += vParent.offsetTop;
vParent = vParent.offsetParent;
}
listDiv.innerHTML = vMnuCode;
listDiv.style.top = menu_top;
listDiv.style.left = menu_left;
if (scroll==0) {listDiv.style.overflow="visible";listDiv.style.width=tWidth}
else {listDiv.style.overflow="scroll";listDiv.style.width=tWidth+18}
listDiv.style.visibility = "visible";
var cssopaction=submenu.filters[0].opacity
submenu.filters[0].opacity=0;
submenu.filters[1].Apply();
submenu.filters[0].opacity=100;
submenu.filters[1].Play();
isvisible = true;
}
function menuitem(lightcolor,normalcolor,icon,title,url)
{
this.lightcolor=lightcolor
this.normalcolor=normalcolor
this.icon=icon
this.title=title
this.url=url
}
function bulidmenu(arrayname)
{
var menuarray=eval(arrayname)
menucontent='
'+menuarray[i].title+' |
'
}
else
{
content='
'+menuarray[i].title+' |
'
}
if (menuarray[i].url!="_disable"){
menucontent=menucontent+'
'
}
else
{
menucontent=menucontent+'
'
}
}
else
{
menucontent=menucontent+'
'
}
}
menucontent=menucontent+"
"
return menucontent
}
function HL_Menu(obj,state)
{
switch (state)
{
case 0:
obj.className="menuover"
break;
case 1:
obj.className="menuup"
break;
}
}
var lb=new Array()
lb[0]=new listbox('listbox0','listbutton0','listvalue0')
lb[1]=new listbox('listbox1','listbutton1','listvalue1')
var list1=new Array()
list1[0]=new menuitem("#B1CBE4","","","ListItem1","")
list1[1]=new menuitem("#B1CBE4","","","ListItem2","")
list1[2]=new menuitem("#B1CBE4","","","ListItem3","")
list1[3]=new menuitem("#B1CBE4","","","ListItem4","")
list1[4]=new menuitem("#B1CBE4","","","ListItem5","")
list1[5]=new menuitem("#B1CBE4","","","ListItem6","")
list1[6]=new menuitem("#B1CBE4","","","ListItem7","")
list1[7]=new menuitem("#B1CBE4","","","ListItem8","")
list1[8]=new menuitem("#B1CBE4","","","ListItem9","")
list1[9]=new menuitem("#B1CBE4","","","ListItem10","")
blist1=bulidmenu("list1")
var list2=new Array()
list2[0]=new menuitem("#B1CBE4","","","字体1","")
list2[1]=new menuitem("#B1CBE4","","","字体2","")
list2[2]=new menuitem("#B1CBE4","","","字体3","")
list2[3]=new menuitem("#B1CBE4","","","字体4","")
list2[4]=new menuitem("#B1CBE4","","","字体5","")
list2[5]=new menuitem("#B1CBE4","","","字体6","")
list2[6]=new menuitem("#B1CBE4","","","字体7","")
list2[7]=new menuitem("#B1CBE4","","","字体8","")
list2[8]=new menuitem("#B1CBE4","","","字体9","")
list2[9]=new menuitem("#B1CBE4","","","字体10","")
blist2=bulidmenu("list2")
function Golist(text)
{
listvalue=eval(lb[listnum].valuename)
listvalue.innerText=text
vDiv = document.all("listDiv");
vDiv.style.visibility = "hidden";
isvisible = false;
}
.lostfocus { border: 1px #ffffff solid; background-color: #ffffff; font-size: 12px; font-family: Arial; }
.getfocus { border: 1px #08246B solid;background-color: #ffffff; font-family: Arial; font-size: 12px; }
.menubar {filter:progid:DXImageTransform.Microsoft.Gradient(gradienttype=0, startcolorstr=#F7F7F7, endcolorstr=#DEDBD6)}
.bodybar {filter:progid:DXImageTransform.Microsoft.Gradient(gradienttype=1, endcolorstr=#F7F7F7, startcolorstr=#DEDBD6)}
.leftitem { font-family: Arial; font-size: 12px; color: #000000; cursor: hand }
.getitem { font-family: Arial; font-size: 12px; color: #000000; cursor: default }
.lostitem { cursor: default; color: #808080; font-size: 12px; font-family: Arial; }
.menuup { PADDING-LEFT: 4px; PADDING-RIGHT: 4px; CURSOR: hand;}
.menuover { PADDING-LEFT: 3px; PADDING-RIGHT: 3px; BACKGROUND-COLOR: #B5BED6; BORDER: 1px solid #08246B; CURSOR: hand; }
.lostlist { border: 1px #ffffff solid; background-color: #ffffff; font-size: 12px; font-family: Arial; }
.getlist { border: 1px #08246B solid;background-color: #ffffff; font-family: Arial; font-size: 12px; }
.listover {BACKGROUND-COLOR: #B5BED6; BORDER-left:1px solid #08246B}
.listDiv { filter: alpha(opacity=90,finishopacity=0,style=0) blendtrans(duration=.3); }
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
工作之余做了这个小东西
仿Office 2003的工具条,主要尝试不用任何图片(当然不可能把所有按扭都做出来),所有的控件都是用Css和java-script做的
菜单就不做了,偷懒中
感兴趣的朋友可以和我联系,大家交流交流.
[email]PuterJam@etang.com[/email]
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]