提示:上下滚动并带有渐隐与渐显效果的例子.
1.将下面的代码复制到<head>内
<style TYPE="text/css">
<!--
.TextScrollStyle {
visibility:hidden;
font-family:Verdana;
font-weight:bold;
text-align:center;
padding:0;
margin:0;
width:100%;
overflow:hidden;
}
-->
</style>
<script language="JavaScript1.2">
/*
Dynamic Fader Script (updated: 00/08/05)
Created and submitted by Nicholas Poh (hwinmain@yahoo.com) to Dynamicdrive.com
Key modifications by Dynamic Drive for stability/ efficiency in NS
For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
*/
//1) Configure messages://设置显示的内容
var TS_message = new Array();
TS_message[0] = '<div align="left">Hello there</div>';
TS_message[1] = '<div align="left">Wow... hope you like it!</div>';
TS_message[2] = '<div align="left">Presented by <A HREF="../../../dynamicdrive.com/index.html">Dynamicdrive.com</A></div>';
//2) Configure fader width and colors:设置长度与颜色
var TS_scrollwidth=400 //configure fader width
var TS_colorFG = 0x000000; // Text color
var TS_colorBG = 0xFFFFFF; //bgColor
// uncomment any value you wanted to change
//var TS_ymax = 50; // How many pixel to move
//var TS_ystep = 1; // 1 or -1 only (Scroll direction)
//var TS_speed = 2; // The smaller the value the faster
//var TS_pause = 100; // Pause time(milisecond) between messages
var TS_fadestep= 20; // Steps to fade in and out
if (document.all)
document.write('<style>#containerarea{width:'+TS_scrollwidth+'}</style>')
</script>
2.将下面的代码复制到<body>内
<DIV id="containerarea">
<SCRIPT LANGUAGE="JavaScript1.2" SRC="textfader.js"></SCRIPT>
</DIV>
3.这里用到一个外部的JS
1) textfader.js
1.将下面的代码复制到<head>内
<style TYPE="text/css">
<!--
.TextScrollStyle {
visibility:hidden;
font-family:Verdana;
font-weight:bold;
text-align:center;
padding:0;
margin:0;
width:100%;
overflow:hidden;
}
-->
</style>
<script language="JavaScript1.2">
/*
Dynamic Fader Script (updated: 00/08/05)
Created and submitted by Nicholas Poh (hwinmain@yahoo.com) to Dynamicdrive.com
Key modifications by Dynamic Drive for stability/ efficiency in NS
For full source code, usage terms, and 100s more scripts, visit http://dynamicdrive.com
*/
//1) Configure messages://设置显示的内容
var TS_message = new Array();
TS_message[0] = '<div align="left">Hello there</div>';
TS_message[1] = '<div align="left">Wow... hope you like it!</div>';
TS_message[2] = '<div align="left">Presented by <A HREF="../../../dynamicdrive.com/index.html">Dynamicdrive.com</A></div>';
//2) Configure fader width and colors:设置长度与颜色
var TS_scrollwidth=400 //configure fader width
var TS_colorFG = 0x000000; // Text color
var TS_colorBG = 0xFFFFFF; //bgColor
// uncomment any value you wanted to change
//var TS_ymax = 50; // How many pixel to move
//var TS_ystep = 1; // 1 or -1 only (Scroll direction)
//var TS_speed = 2; // The smaller the value the faster
//var TS_pause = 100; // Pause time(milisecond) between messages
var TS_fadestep= 20; // Steps to fade in and out
if (document.all)
document.write('<style>#containerarea{width:'+TS_scrollwidth+'}</style>')
</script>
2.将下面的代码复制到<body>内
<DIV id="containerarea">
<SCRIPT LANGUAGE="JavaScript1.2" SRC="textfader.js"></SCRIPT>
</DIV>
3.这里用到一个外部的JS
1) textfader.js
文章来源:http://www.aspxboy.com/myjs/baoku/0055.htm