0


歡迎光臨!! 救國團台中學苑 社會教育研習中心 電腦班隊研習營【網頁設計課程】


跑馬燈特效語法




狀態列跑馬燈

 

捲動式

將下列語法貼於</head>之前

<script language="JavaScript">
<!--
function scroll(seed)
{
var m1 = "救國團台中學苑"
var m2 = "電腦研習班   "
var msg=m1+m2;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scroll(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
} else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scroll(100)",7);
}
}
}
timerONE=window.setTimeout('scroll(100)',50);
-->
</script>


打字式

將下列語法貼於</head>之前

<script language="JavaScript">
<!--
var msg="歡迎光臨【救國團台中學苑】網頁設計班教學網頁";
var interval = 250;
seq = 0;
function Scroll() {
len = msg.length;
window.status = msg.substring(0, seq+1);
seq++;
if ( seq >= len ) { seq = 0 };
window.setTimeout("Scroll();", interval );
}
-->
</script>

將下列語法貼於<body>之中

 onLoad="Scroll();"


多行打字式

將下列語法貼於</head>之前

<script language="JavaScript">
<!--
var speed = 100
var pause = 2000
var timerID = null
var bannerRunning = false
var ar = new Array()
ar[0] = "救國團台中學苑"
ar[1] = "電腦班隊研習營"
ar[2] = "網頁設計班"
ar[3] = "教學網站"
var currentMessage = 0
var offset = 0
function stopBanner() {
if (bannerRunning)
clearTimeout(timerID)
bannerRunning = false
}
function startBanner() {
stopBanner()
showBanner()
}
function showBanner() {
var text = ar[currentMessage]
if (offset < text.length) {
if (text.charAt(offset) == " ")
offset++
var partialMessage = text.substring(0, offset + 1)
window.status = partialMessage
offset++ // IE sometimes has trouble with "++offset"
timerID = setTimeout("showBanner()", speed)
bannerRunning = true
} else {
offset = 0
currentMessage++
if (currentMessage == ar.length)
currentMessage = 0
timerID = setTimeout("showBanner()", pause)
bannerRunning = true
}
}
-->
</script>

將下列語法貼於<body>之中

 onLoad="startBanner()"

 


抹去式

將下列語法貼於網頁呈現的地方

<script language="JavaScript">
<!--
var current = 0
var x = 0
var speed = 120
var back = 15
var speed2 = 1500
var back2 = 1500
var type = new Array(4)
type[0]="救國團台中學苑"
type[1]="電腦班隊研習營......^_^"
type[2]="網頁設計班"
type[3]="http://wssh0812.myweb.hinet.net/05/index.htm"
function typewrite() {
var m = type[current]
window.status = m.substring(0, x++)
if (x == m.length + 1) {
setTimeout("erase()", back2)
}
else {
setTimeout("typewrite()", speed)
}
}
function erase() {
var m = type[current]
window.status = m.substring(0, x)
x=x-1
if (x < 0) {
current++
x=0
setTimeout("typewrite()", speed2)
if (current > type.length - 1) {
current = 0
}
}
else {
setTimeout("erase()", back)
}
}
typewrite()
-->
</script>

 

在 var speed = 120 中修改跑馬燈的文字顯示速度
在 var back = 15 中修改跑馬燈的文字消除速度
在 var speed2 = 1500 中修改跑馬燈文字的停留間隔
在 var back2 = 1500 中修改兩個跑馬燈文字間的時間間隔
在 var type = new Array(4) 中修改跑馬燈訊息的總數量
自行修改跑馬燈的訊息文字
 

 

 


上一頁下一頁 │                                      │ 回首頁 回特效語法  │