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

📄 824text4.htm

📁 javascript各种效果的实例及源代码
💻 HTM
字号:
<html>
<head>
<title>选择显示文字方式</title>
<style type="text/css">
<!--
body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 A:hover { COLOR: red; FONT-SIZE: 9pt; 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" onLoad="DisplayMsg()">
<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">

<!-- HTML comment to placate non JavaScript capable browsers

function AraVob() {
}
var ScreenLine = new AraVob();
ScreenLine[1]  = "当康熙要小宝剿灭天地会时,小宝说出一番道理来:“皇上,他们要来害你,我拼命阻挡,奴才对你是讲义气的。";
ScreenLine[2]  = "小宝为了这个道理不要高官,不要厚禄,甚至连性命也可以豁出去了,于是康熙虽是恼怒,却也敬重他为人有义。";
ScreenLine[3]  = "那么,说句真心话,在这世俗社会中,若真的有一个如小宝一样既能赚钱,又会花钱 ";
ScreenLine[4]  = "于是在金庸先生笔下,只要跟小宝作对之人,均无什么好下场,都同风际中一样自取灭亡。";
ScreenLine[5]  = "旁观者虽瞧你行为话语不耻,却也不得不佩服。 ";
ScreenLine[6] = "小宝为了这个道理不要高官,不要厚禄,甚至连性命也可以豁出去了,于是康熙虽是恼怒,却也敬重他为人有义";
ScreenLine[7] = " 嘻,“男孩不坏,女孩不爱”嘛!";
ScreenLine[8] = " 会玩会闹会逗你天心,骨子里也讲点良心、义气的俗人,你会不会喜欢他?爱他?";
ScreenLine[9] = "那么,说句真心话,在这世俗社会中,若真的有一个如小宝一样既能赚钱,又会花钱";
ScreenLine[10] = "也许小宝还够不上潇洒,但他在这个世俗语社会里为人处事的游刃有余,是谁也比不上的。";
ScreenLine[11] = "于是在金庸先生笔下,只要跟小宝作对之人,均无什么好下场,都同风际中一样自取灭亡。";
/*
To change or add lines, just replace values of or add to ScreenLine[n]
above.   Use \" in the message text for quotes and \t for tabs.
*/
var msgNum = 1;          // set to first message to display
var msgCnt = 11;         // set to number of last ScreenLine to display.
var typeSpeed = 100;      // the typing rate in milliseconds (higher number type more slowly)
var lineDelay = 3000     // the delay time at end of line. (unless the line is a single space)
var pagLen = 6;          // number of lines per page (usually the number of rows in the TEXTAREA)   
var delay = typeSpeed;     
var timerPS = null;
var linPntr = 0;
var tally = 1;
var msg = " ";
var outMsg = "";
var i = 0;
var typingon = false;

// set up ScreenLines for display
for (x = msgCnt; 1 <= x; x--) {
  ScreenLine[x+pagLen] = ScreenLine[x] + "\r\n";
}
for (x = 1; x <= (pagLen); x++) {
  ScreenLine[x] =  " \r\n";
}
 msgCnt +=  pagLen;
 msg = ScreenLine[1];
// end setup

function SwitchIt() {
 typingon = !typingon;
}

function DisplayScroll() {
 if (msgNum < pagLen) {
  delay = typeSpeed;
 }
 else {
  delay = lineDelay;
 }
 ChangeMsg();
 outMsg += msg;
 self.document.msgform.msgarea.value = outMsg;
 if (typingon == true) {
  timerPS = setTimeout("DisplayMsg()",delay);
 }
 else {
  clearTimeout(timerPS);
  timerPS = setTimeout("DisplayScroll()",delay);
 }
}
function DisplayMsg() {
 if (msg.length <= i) {
  i = 0;
  ChangeMsg();
 }
 outMsg += msg.charAt(i);
 i++; 
 if (msg.charAt(i) != "\n" || msg == " \r\n") {
  delay = typeSpeed;
 }
 else {
  delay = lineDelay;
 }
 self.document.msgform.msgarea.value = outMsg;
 if (typingon == false) {
  timerPS = setTimeout("DisplayScroll()",delay);
 }
 else {
  clearTimeout(timerPS);
   timerPS = setTimeout("DisplayMsg()",delay);
 }
}

function ChangeMsg() {
 msgNum++;
 if (msgCnt < msgNum) {
   msgNum = 1;
 }
 if (pagLen <= tally) {
   chgPage();
 }
 tally++;
 msg = ScreenLine[msgNum];
}

function chgPage() {
 if (msgNum < pagLen) {
   linPntr = msgCnt - pagLen + msgNum + 1;
 }
 else {
   linPntr = msgNum - (pagLen - 1);
 }

 outMsg =   ScreenLine[linPntr];
 for (p = 1; p < (pagLen - 1); p++) {
   linPntr++;
   if (msgCnt < linPntr) {
     linPntr = 1;
   }
   outMsg += ScreenLine[linPntr];
 }
  
}

function quitDisplay() {
  self.document.msgform.msgarea.value = "Type a Page for yourself today!";
}
// -->

</SCRIPT>


<FORM NAME = "msgform" ACTION = " ">
 <TEXTAREA NAME = "msgarea" COLS = 66 ROWS = 6>
 JavaScript (or JScript) Power needed.
 </TEXTAREA>
</FORM>
<FORM>
  <INPUT TYPE="button"
         NAME="button1"
         VALUE="逐个显示/逐行显示"
         onClick="SwitchIt()">
 </FORM>

</td></tr>
</table></center>
<br>
<br>
<center>
<textarea name=source rows=12 cols=45 class=yk9>
脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE = "JavaScript">

<!-- HTML comment to placate non JavaScript capable browsers

function AraVob() {
}
var ScreenLine = new AraVob();
ScreenLine[1]  = "You can display multiple lines of text here,";
ScreenLine[2]  = "including \"blank\" lines.";
ScreenLine[3]  = " ";
ScreenLine[4]  = "Isn't this easier to read than \"sideways\" scrollers?";
ScreenLine[5]  = " ";
ScreenLine[6] = "Click on the \"Type/Scroll\" button to switch between....";
ScreenLine[7] = "  scrolling the page up with complete lines or,";
ScreenLine[8] = "  typing a line and scrolling the page up.";
ScreenLine[9] = " ";
ScreenLine[10] = "Aren't you glad your browser has JavaScript (JScript) power?";
ScreenLine[11] = "Enjoy!....";
/*
To change or add lines, just replace values of or add to ScreenLine[n]
above.   Use \" in the message text for quotes and \t for tabs.
*/
var msgNum = 1;          // set to first message to display
var msgCnt = 11;         // set to number of last ScreenLine to display.
var typeSpeed = 50;      // the typing rate in milliseconds (higher number type more slowly)
var lineDelay = 2000     // the delay time at end of line. (unless the line is a single space)
var pagLen = 6;          // number of lines per page (usually the number of rows in the TEXTAREA)   
var delay = typeSpeed;     
var timerPS = null;
var linPntr = 0;
var tally = 1;
var msg = " ";
var outMsg = "";
var i = 0;
var typingon = false;

// set up ScreenLines for display
for (x = msgCnt; 1 <= x; x--) {
  ScreenLine[x+pagLen] = ScreenLine[x] + "\r\n";
}
for (x = 1; x <= (pagLen); x++) {
  ScreenLine[x] =  " \r\n";
}
 msgCnt +=  pagLen;
 msg = ScreenLine[1];
// end setup

function SwitchIt() {
 typingon = !typingon;
}

function DisplayScroll() {
 if (msgNum < pagLen) {
  delay = typeSpeed;
 }
 else {
  delay = lineDelay;
 }
 ChangeMsg();
 outMsg += msg;
 self.document.msgform.msgarea.value = outMsg;
 if (typingon == true) {
  timerPS = setTimeout("DisplayMsg()",delay);
 }
 else {
  clearTimeout(timerPS);
  timerPS = setTimeout("DisplayScroll()",delay);
 }
}
function DisplayMsg() {
 if (msg.length <= i) {
  i = 0;
  ChangeMsg();
 }
 outMsg += msg.charAt(i);
 i++; 
 if (msg.charAt(i) != "\n" || msg == " \r\n") {
  delay = typeSpeed;
 }
 else {
  delay = lineDelay;
 }
 self.document.msgform.msgarea.value = outMsg;
 if (typingon == false) {
  timerPS = setTimeout("DisplayScroll()",delay);
 }
 else {
  clearTimeout(timerPS);
   timerPS = setTimeout("DisplayMsg()",delay);
 }
}

function ChangeMsg() {
 msgNum++;
 if (msgCnt < msgNum) {
   msgNum = 1;
 }
 if (pagLen <= tally) {
   chgPage();
 }
 tally++;
 msg = ScreenLine[msgNum];
}

function chgPage() {
 if (msgNum < pagLen) {
   linPntr = msgCnt - pagLen + msgNum + 1;
 }
 else {
   linPntr = msgNum - (pagLen - 1);
 }

 outMsg =   ScreenLine[linPntr];
 for (p = 1; p < (pagLen - 1); p++) {
   linPntr++;
   if (msgCnt < linPntr) {
     linPntr = 1;
   }
   outMsg += ScreenLine[linPntr];
 }
  
}

function quitDisplay() {
  self.document.msgform.msgarea.value = "Type a Page for yourself today!";
}
// -->

</SCRIPT>


<FORM NAME = "msgform" ACTION = " ">
 &lt;TEXTAREA NAME = "msgarea" COLS = 66 ROWS = 6&gt;
 JavaScript (or JScript) Power needed.
 &lt;/TEXTAREA&gt;
</FORM>
<FORM>
  <INPUT TYPE="button"
         NAME="button1"
         VALUE="逐个显示/逐行显示"
         onClick="SwitchIt()">
 </FORM>





第二步:把如下代码加入<body>区域中
<body bgcolor="#fef4d9" onLoad="DisplayMsg()">
</textarea>
<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>
<br>
</body>
</html>

⌨️ 快捷键说明

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