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

📄 text12.htm

📁 javascript各种效果的实例及源代码
💻 HTM
字号:
<html>
<head>
<title>文字特殊显示</title>
<style type="text/css">
<!--
body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
--></style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#fef4d9">
<br>
<br>
<center><font color=red face="隶书" size=6>文字特殊显示</font></center>
<br>
<center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面框中为脚本显示区</strong></font></td></tr>
<tr><td align=center><script language="JavaScript">
<!--


IE4 = navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4;	
NS4 = navigator.appName.substring(0,8) == "Netscape" && parseInt(navigator.appVersion) >= 4;
	
// checkBrowser() -- Checks whether the browser is new enough for some DynamicMovement ...

function checkBrowser(){
	if(IE4 || NS4){
		return true;
	}
	return false;
}

// movableObj() -- Creates a new movable object

function movableObj(startX, startY, endX, endY, delay, speed, refId){
	this.sX = startX; this.sY = startY;	this.eX = endX;
	this.eY = endY;	this.de = delay; this.sp = speed;
	this.ref = refId;
	xL = endX - startX;
	yL = endY - startY;
	with (Math){
		if(abs(xL) > abs(yL)){
			this.xS = (xL > 0)?1:-1;
			this.yS = (yL > 0)?abs(yL / xL):-abs(yL / xL);
			this.howManySteps = abs(xL / speed);
		} else if(abs(yL) > abs(xL)){
			this.yS = (yL > 0)?1:-1;
			this.xS = (xL > 0)?abs(xL / yL):-abs(xL / yL);
			this.howManySteps = abs(yL / speed);
		} else {
			this.yS = (yL > 0)?1:-1;
			this.xS = (xL > 0)?1:-1;
			this.howManySteps = abs(xL / speed);
		}
	}
	this.startMovement = startMovement;
}

// startMovement() -- starts the movement

function startMovement(){
	if(checkBrowser()){
		if(IE4){
			ref = document.all(this.ref).style;
		} else {
			ref = document[this.ref];
		}
		doDynamicMovement(this.sX, this.sY, this.eX, this.eY, this.de, this.xS, this.yS, ref, this.sp, this.howManySteps);
	}
}

// doDynamicMovement() -- does the Dynamic Movement

function doDynamicMovement(curX, curY, eX, eY, sp, xS, yS, ref, speed, hS){
	if(Math.floor(hS - 1) != 0){
		hS--;
		curX += xS * speed;
		curY += yS * speed;
		ref.left = Math.round(curX);
		ref.top = Math.round(curY);
		setTimeout("doDynamicMovement(" + curX + ", " + curY + ", " + eX + ", " + eY + ", " + sp + ", " + xS + ", " + yS + ", ref, " + speed + ", " + hS + ")", sp);
	} else {
		setPos(eX, eY, ref);	
	}
}

// setPos() -- sets the end position accurately when doDynamicMovement has done its job

function setPos(x, y, ref){
	ref.left = x;
	ref.top = y;
}

// -->
</script>


<table>
  <tr>
    <td><font face="Verdana, Arial"><h3>&nbsp; </h3>
    <font size="2"><form>
      <div align="center"><center><p><input type="button" onClick="dynaText.startMovement()"
      value="按下去看看"> </p>
      </center></div>
    </form>
    <p>&nbsp; </font></p>
    <div id="wow"
    style="position: absolute; left: -100; top: -100; width: 300;
		font-family: Verdana, Arial; font-size: 20pt"><p>欢迎光临南京有线台! 
    </font></p>
    </div></td>
  </tr>
</table>
<script language="JavaScript">
<!--

// Here we define the movable object
dynaText = new movableObj(-100,-100,80,180,10,10,"wow");

// -->
</script>
</td></tr></table></center>
<br>
<br>
<center>

<SCRIPT LANGUAGE="JavaScript">

<!-- hide
function goHist(a)
{
   history.go(a);
}
//-->
</script>
<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<center>
<textarea name=source rows=12 cols=55 class=yk9>
脚本说明:
把如下代码加入<body>区域中:
<script language="JavaScript">
<!--


IE4 = navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4;	
NS4 = navigator.appName.substring(0,8) == "Netscape" && parseInt(navigator.appVersion) >= 4;
	
// checkBrowser() -- Checks whether the browser is new enough for some DynamicMovement ...

function checkBrowser(){
	if(IE4 || NS4){
		return true;
	}
	return false;
}

// movableObj() -- Creates a new movable object

function movableObj(startX, startY, endX, endY, delay, speed, refId){
	this.sX = startX; this.sY = startY;	this.eX = endX;
	this.eY = endY;	this.de = delay; this.sp = speed;
	this.ref = refId;
	xL = endX - startX;
	yL = endY - startY;
	with (Math){
		if(abs(xL) > abs(yL)){
			this.xS = (xL > 0)?1:-1;
			this.yS = (yL > 0)?abs(yL / xL):-abs(yL / xL);
			this.howManySteps = abs(xL / speed);
		} else if(abs(yL) > abs(xL)){
			this.yS = (yL > 0)?1:-1;
			this.xS = (xL > 0)?abs(xL / yL):-abs(xL / yL);
			this.howManySteps = abs(yL / speed);
		} else {
			this.yS = (yL > 0)?1:-1;
			this.xS = (xL > 0)?1:-1;
			this.howManySteps = abs(xL / speed);
		}
	}
	this.startMovement = startMovement;
}

// startMovement() -- starts the movement

function startMovement(){
	if(checkBrowser()){
		if(IE4){
			ref = document.all(this.ref).style;
		} else {
			ref = document[this.ref];
		}
		doDynamicMovement(this.sX, this.sY, this.eX, this.eY, this.de, this.xS, this.yS, ref, this.sp, this.howManySteps);
	}
}

// doDynamicMovement() -- does the Dynamic Movement

function doDynamicMovement(curX, curY, eX, eY, sp, xS, yS, ref, speed, hS){
	if(Math.floor(hS - 1) != 0){
		hS--;
		curX += xS * speed;
		curY += yS * speed;
		ref.left = Math.round(curX);
		ref.top = Math.round(curY);
		setTimeout("doDynamicMovement(" + curX + ", " + curY + ", " + eX + ", " + eY + ", " + sp + ", " + xS + ", " + yS + ", ref, " + speed + ", " + hS + ")", sp);
	} else {
		setPos(eX, eY, ref);	
	}
}

// setPos() -- sets the end position accurately when doDynamicMovement has done its job

function setPos(x, y, ref){
	ref.left = x;
	ref.top = y;
}

// -->
</script>


<table width="600">
  <tr>
    <td><font face="Verdana, Arial"><h3>&nbsp; </h3>
    <font size="2"><form>
      <div align="center"><center><p><input type="button" onClick="dynaText.startMovement()"
      value="按下去看看"> </p>
      </center></div>
    </form>
    <p>&nbsp; </font></p>
    <div id="wow"
    style="position: absolute; left: -100; top: -100; width: 300;
		font-family: Verdana, Arial; font-size: 20pt"><p>欢迎光临南京有线台! 
    </font></p>
    </div></td>
  </tr>
</table>
<script language="JavaScript">
<!--

// Here we define the movable object
dynaText = new movableObj(-100,-100,80,180,10,10,"wow");

// -->
</script>
</textarea>
<br>
<br>
</body>
</html>

⌨️ 快捷键说明

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