⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mywlhead.js

📁 编程摇篮德CB学习课程
💻 JS
📖 第 1 页 / 共 2 页
字号:
//作者:庄严。
//本代码仅在 '没有弯路'网校的当前网页上使用有效
/////////////////////公用变量/////////////////////////////
LastModifyDate = "2002年10月27日";  //最后更新日期:
HomePage = "http://www.bcbschool.com/" //主页

///////////////////////父URL//////////////////////////
//普通网页:
var CellBtnImgPath = "IMAGES/";  //CellBtn 图象的父URL
var CellBtnObjPath = "";         //链接目标html文件的父URL

//BBS下的网页
//  CellBtnImgPath = HomePage + "IMAGES/";  //CellBtn 图象的父URL
//  CellBtnObjPath = HomePage;         //链接目标html文件的父URL

//设置是否URL路径:
function SetParentURL(useURL)
{
  if (!useURL.length)
  {
    CellBtnImgPath = "IMAGES/";
    CellBtnObjPath = "";
  }
  else
  {
    CellBtnImgPath = useURL + "IMAGES/";
    CellBtnObjPath = useURL;
  }
}

/////////////////颜色设置/////////////////////////////////
UnSelectBkColor   = "#E7EFFF";;  //平常颜色
MouseOnBkColor = "white";  //鼠标下的颜色
SelectBkColor = "#99ccff";  //选中时的背景色
SelectFtColor = "red";      //选中的文字颜色,
UnSelectFtColor = "black";           //未选中的文字颜色,使用网页设置的值
CurPageFtColor = "blue"      //当前页的按钮文字颜色

CurPageIndex = 0;

/////////////////Cell Style////////////////
//单元格需要用到的风格
CellStyleStr = "<style type=\"text/css\"> <!--\r\n .menucell { font-size: 10pt }\r\n"
	+ "#menuhref { text-decoration: none }\r\n"
	+ ".submenucell { font-size: 9pt;} --> </style>";
document.write(CellStyleStr);

//子页单元格的风格:
CellStyleStr = "<style type=\"text/css\"> <!--\r\n .submenucell { font-size: 9pt;}\r\n  --> </style>\r\n"
document.write(CellStyleStr);


//对象:CellBtn
//String Text :    按钮的标题
//String Alt  :    鼠标移上时的短提示
//String Hint :    鼠标移上时的长提示
//String ObjUrl  : 点击后的目标网址
//String Img  :    图象名
//String ImgId:    图象ID后部 (完整ID为 Img+后缀)
//Bool   CurPage : 是否当前页,如果是当前页,字体使用 CurPageFontColor颜色

function TCellBtn(Text,Alt,Hint,ObjUrl,Img,ImgId)
{
 this.Text = Text;
 this.Alt = Alt;
 this.Hint = Hint;
 this.ObjUrl = ObjUrl;
 this.Img = Img;
 this.ImgId = ImgId;

 this.CurPage = false;

 this.Width = 0;
}

CellBtns = new Array();
CellBtnCount = 0;

SubPages = new Array();

//鼠标事件引起 CellBtn 图片,背景颜色的改变
function show_menu_hint(I,IsMouseOver)
{
 imgid = 'img' + CellBtns[I].ImgId;
 imgsrc = eval(imgid).src;

// evSrc = event.srcElement;

 if(IsMouseOver){
    menu_hint.innerText = CellBtns[I].Hint;
    if(I != CurPageIndex)
        re =/n.gif/;   //原来为普通状态(黑白)
    else
        re = /c.gif/;  //原来为选中

    imgsrc=imgsrc.replace(re,'m.gif'); //mouse on

 // evSrc.style.backgroundColor = SelectBkColor;
    }
 else{
    menu_hint.innerText = CellBtns[CurPageIndex].Hint;
    re =/m.gif/;

   if( I != CurPageIndex)
	imgsrc=imgsrc.replace(re,'n.gif');
   else
	imgsrc=imgsrc.replace(re,'c.gif');

    // evSrc.style.backgroundColor = UnSelectBkColor;
    }

 eval(imgid +".src=\'" + imgsrc +"\'");
}

//鼠标事件引起 CellBtn 文字颜色的改变
function show_menu_href(I,IsMouseOver)
{
  evSrc = event.srcElement;

  if(IsMouseOver){
    UnSelectFtColor = evSrc.style.color;
    evSrc.style.color = SelectFtColor;
    }
  else if(I == CurPageIndex){
    evSrc.style.color = CurPageFtColor;
    }
  else{
    evSrc.style.color = UnSelectFtColor;
    UnSelectFtColor = '';
    }
}


function TSubPage(txt,link)
{
	this.txt = txt;
	this.link = link;

	this.cur = false;
}

function AddSubPage(txt,link)
{
	SubPagesCount = SubPages.length;

	SubPages[SubPagesCount] = new TSubPage(txt,link);
}

function SetActiveSubPage(I)
{
	pageCount = SubPages.length;

	for(i=0;i < pageCount;i++)
	{
		SubPages[i].cur = false;
	}

	I--;
	if(I>=0 && I<pageCount)
		SubPages[I].cur = true;
}

function OutputSubPage()
{
	SubPagesCount = SubPages.length;

	document.write('<p align=\"center\">');

	for(i=0;i<SubPagesCount;i++)
	{
		document.write('<a href= \"');
		document.write(SubPages[i].link);
		document.write('\">');

		if(SubPages[i].cur)
			document.write("<B>&gt;");
		else
			document.write("-");

		document.write(SubPages[i].txt);

		if(SubPages[i].cur)
			document.write("&lt;</B>");
		else
			document.write("-");

		document.write('</a>');
		document.write('&nbsp;');
	}

	document.write('</p>');
}


function InitCellBtns(curPageText)
{
  CellBtns[0] = new TCellBtn("首页","回到首页","欢迎来到“编程摇篮”","index.php","menuck_n.gif","sy");
  CellBtns[1] = new TCellBtn("用户","您的资料","本页显示您在本站的种资料","v5_userpage.php","menuck_n.gif","gr");
  CellBtns[2] = new TCellBtn("课程","精彩课程","精彩课程,尽在其中","v5_jiaoxue.php","menuck_n.gif","kc");
  CellBtns[3] = new TCellBtn("文章","编程文章","学习技巧,提高能力,不能不读","v5_art.php","menuck_n.gif","wz");
  CellBtns[4] = new TCellBtn("论坛","答疑解惑","学习上有问题?请到此征求答案,来此高谈阔论","http://www.bcbschool.com/cgi-bin/board.cgi?id=test","menuck_n.gif","wd");            //MODIFY
  CellBtns[5] = new TCellBtn("软件","软件产品","本站的软件产品,欢迎共享、试用、选购","v5_softs.php","menuck_n.gif","rj");     //NEW

  CellBtnCount = CellBtns.length;

  CellWidth = (760-36) / CellBtnCount; //36 是最右列(含一个修饰图标)的宽度

  for( I = 0;I<CellBtnCount;I++)
  {

  	if (curPageText == CellBtns[I].Text)
  	{
  	    CurPageIndex = I;
  	    CellBtns[I].CurPage = true;
  	    CellBtns[I].Hint = "您的位置 - [" + CellBtns[I].Text + "] " + CellBtns[I].Hint;
  	}

  	//if ( I < CellBtnCount-1)
  	//{
  	  CellBtns[I].Width = CellWidth;
  	//}
  	//else
  	//{
  	  //CellBtns[I].Width = 760 - CellWidth * (I-1);
  	//}
  }
}

//输出一个CellBtn
function OutputACellBtn(I)
{
  document.write('<!--' + CellBtns[I].Text + '-->\r\n');
  document.write('<td width=\"',CellBtns[I].Width,'\" ');
  document.write('height=\"20\" rowspan=\"1\" ');

  document.write('onmouseover=\"style.backgroundColor=\'',MouseOnBkColor/*SelectBkColor*/,'\',show_menu_hint(',I,',true)\"\r\n');
  document.write('onmouseout=\"style.backgroundColor=\'',((I==CurPageIndex)? SelectBkColor : UnSelectBkColor), '\',show_menu_hint(',I,',false)\"\r\n');

  document.write('class = \"menucell\" bgcolor= ',((I!=CurPageIndex)?  UnSelectBkColor : SelectBkColor));

  document.write(' style=\"border-right: 1 solid #ffffff \" ');
  document.write('>\r\n');

  if (I != 6)
    document.write('<p align=\"center\"><a href=\"',CellBtnObjPath+CellBtns[I].ObjUrl,'\"  class=\"Au\"'); // id=\"menuhref\"
  else
    document.write('<p align=\"center\"><a href=\"',CellBtns[I].ObjUrl,'\" class=\"Au\" '); //id=\"menuhref\"

  document.write('onmouseover=\"show_menu_href(',I,',true)\"\r\n');
  document.write('onmouseout=\"show_menu_href(',I,',false)\">\r\n');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -