5、一个很Cool的JS菜单效果
<script>
function CoolMenuControl(){
//-----常规变量---
this.lastScrollX=0;
this.lastScrollY=0;
this.lastScrollW=0;
this.lastScrollH=0;
this.td_X=0;
this.td_Y=0;
this.td_W=0;
this.td_H=0;
this.td=0;
this.mouseon=0;
this.current=null
this.hk_name;
this.hktable_name;
this.menudiv_name;
this.menutable_name;
this.ml=0;
this.menuarray=new Array();
this.speed;
this.href="";
//-----菜单项目---
function menuitem(type,value,url,target){
this.type=type
this.value=value
this.url=url
this.target=target
}
//-----插入菜单---
this.insertmenu=function(type,value,url,target){
this.menuarray[this.menuarray.length]=new menuitem(type,value,url,target)
}
//-----程序初试化---
this.init=function(name,bdc,bgc,speed,Alpha){
var inhtml=""
var cellcount=0
var lastcellcount=0
this.hk_name=name "hk"
this.hktable_name=name "hktable"
this.menudiv_name=name "menudiv"
this.menutable_name=name "menutable"
this.speed=speed
for (i=0;i<this.menuarray.length;i )
{
if (this.menuarray[i].type=="2") cellcount=cellcount 1
if (this.menuarray[i].type=="1" || this.menuarray[i].type=="0") {cellcount=0}
if (lastcellcount<cellcount) {lastcellcount }
}
//alert(cellcount)
stylecode="cursor:hand;filter:Alpha(style=0,opacity=" Alpha ");background-color:" bgc
suspendcode="<DIV id=" this.hk_name " style='POSITION:absolute;' onclick='" name ".doClick()'>"
"<table id=" this.hktable_name " border='1' width='0' cellspacing='0' style='border-collapse: collapse' bordercolor='" bdc "'>"
"<tr><td height='18' style='" stylecode "'></td></tr></table></div>";
document.write(suspendcode);
var fcell=true
for (i=0;i<this.menuarray.length;i )
{
switch(this.menuarray[i].type)
{
case "0":
t=cellcount*2
if (t<=0)
{
inhtml ='<tr><td colspan=2 class=ht onmouseover='' name '.href="' this.menuarray[i].url ',' this.menuarray[i].target '"'>' this.menuarray[i].value
}
else
{
inhtml ='<tr><td colspan=' t ' class=ht onmouseover='' name '.href="' this.menuarray[i].url ',' this.menuarray[i].target '"'>' this.menuarray[i].value
}
fcell=true
break;
case "1":
t=(cellcount-1)*2
if (t<=0)
{
inhtml ='<tr><td width=6><td onmouseover='' name '.href="' this.menuarray[i].url ',' this.menuarray[i].target '"'>' this.menuarray[i].value
}
else
{
inhtml ='<tr><td width=6><td colspan=' t ' onmouseover='' name '.href="' this.menuarray[i].url ',' this.menuarray[i].target '"'>' this.menuarray[i].value
评论加载中…
![]() |