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

📄 navbar.htm

📁 一部非常好的javaScript教程
💻 HTM
字号:
<HTML>
<HEAD>
<TITLE>导航条 Scriptlet</TITLE>
<SCRIPT LANGUAGE = Javascript TYPE="text/javascript">
<!--

var public_link1href, public_link2href, public_link3href, public_link4href, public_link5href;
var public_docspans;
var public_divWidth, public_divHeight;
var highLightColor;

function public_setForeColor(foreColor)
{
	theDiv.style.color = foreColor;
}

function public_setBackColor(backColor)
{
	theDiv.style.backgroundColor = backColor;
}

function public_setFont(newFont)
{
	theDiv.style.fontFamily = newFont;
}

function public_setFontSize(fSize)
{
	theDiv.style.fontSize = fSize;
}

function public_setFontStyle(newStyle)
{
	theDiv.style.fontStyle = newStyle;
}

function public_setWidth(newWidth)
{
	public_divWidth = newWidth;
	theDiv.style.width = newWidth;
}

function public_setHeight(newHeight)
{
	public_divHeight = newHeight;
	theDiv.style.height = newHeight;
}

function public_setHighLightColor(col)
{
	highLightColor = col;
}

function public_setLinks(text1, href1, text2, href2, text3, href3, text4, href4, text5, href5)
{
	link1.innerText = text1;
	link2.innerText = text2;
	link3.innerText = text3;
	link4.innerText = text4;
	link5.innerText = text5;
	public_link1href = href1;
	public_link2href = href2;
	public_link3href = href3;
	public_link4href = href4;
	public_link5href = href5;
}

function public_setOrientation(orient)
{
	if (orient == "horizontal")
	{	
		public_docspans = document.all.tags("span");
		for (i = 0; i<public_docspans.length; i++)
		{
			public_docspans(i).style.width = "18%";
			public_docspans(i).style.height = "90%";
			public_docspans(i).style.left = ((18*i+5)/100)*public_divWidth;
			public_docspans(i).style.textAlign = "center";
			public_docspans(i).style.top = "55%";
		}
	}
	else
	{
		public_docspans = document.all.tags("span");
		for (i = 0; i<public_docspans.length; i++)
		{
			public_docspans(i).style.width = "90%";
			public_docspans(i).style.height = "18%";
			public_docspans(i).style.left = "5%";
			public_docspans(i).style.textAlign = "center";
			public_docspans(i).style.top = ((18*i+5)/100)*public_divHeight;
		}
	}
}

function sethref()  
{
	if (window.event.srcElement.id == "link1")
	{
		alert(public_link1href);
	}
	if (window.event.srcElement.id == "link2")
	{
		alert(public_link2href);
	}
	if (window.event.srcElement.id == "link3")
	{
		alert(public_link3href);
	}
	if (window.event.srcElement.id == "link4")
	{
		alert(public_link4href);
	}
	if (window.event.srcElement.id == "link5")
	{
		alert(public_link5href);
	}
}

var defaultColor;
var defaultStyle;

function highLight()
{
	if(window.event.srcElement.id != "theDiv")
	{
		defaultColor = window.event.srcElement.style.color;
		defaultStyle = window.event.srcElement.style.fontStyle;

		window.event.srcElement.style.color = highLightColor;
		window.event.srcElement.style.fontStyle = "italic";
	}
}

function highLightOff()
{
	if(window.event.srcElement.id != "theDiv")
	{
		window.event.srcElement.style.color = defaultColor;
		window.event.srcElement.style.fontStyle = defaultStyle;
	}
}
// -->
</SCRIPT>
</HEAD>
<BODY leftmargin=20 topmargin=20>
<DIV ID=theDiv style="position:absolute; width:0; height:0" onclick="sethref()" onmouseover="highLight()" onmouseout="highLightOff()">
	<SPAN ID=link1 STYLE="position:absolute; top:4%;  left:10%; width:80%; height:20%; cursor:hand; text-align:center; font-weight:bold"></SPAN>
	<SPAN ID=link2 STYLE="position:absolute; top:22%; left:10%; width:80%; height:18%; cursor:hand; text-align:center; font-weight:bold"></SPAN>
	<SPAN ID=link3 STYLE="position:absolute; top:42%; left:10%; width:80%; height:18%; cursor:hand; text-align:center; font-weight:bold"></SPAN>
	<SPAN ID=link4 STYLE="position:absolute; top:62%; left:10%; width:80%; height:18%; cursor:hand; text-align:center; font-weight:bold"></SPAN>
	<SPAN ID=link5 STYLE="position:absolute; top:84%; left:10%; width:80%; height:16%; cursor:hand; text-align:center; font-weight:bold"></SPAN>
</DIV>
</BODY>
</HTML>

⌨️ 快捷键说明

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