HTML achieves rolling subtitle Effects

Source: Internet
Author: User

Add the following content between <body> and </body>:

<Table border = "0" cellspacing = "5" cellpadding = "0" vspace = "0" hspace = "0" bordercolor = "# b7b4b5">
<Tr> <TD colspan = "2">
<! -Direction = up/down/left/right/...>
<! -Height = subtitle height width = subtitle width>
<Marquee direction = up Height = 150 width = 100
Onmouseout = This. scrolldelay = 1
Onmouseover = This. scrolldelay = 600
Scrollamount = 1 scrolldelay = 1 class = "TT">
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect <br>
Scroll subtitle effect </marquee>
</TD> </tr> </table>

I. Place the following code between head and head.
<Style type = "text/CSS">
<! --
. Main {
Font-family: Comic Sans MS;
Font-size: 13pt;
Font-weight: bold;
}
-->
</Style>
<Script language = "JavaScript">

Bname = navigator. appname;
Bversion = parseint (navigator. appversion)
If (bname = "Netscape" & bversion> = 4) | (bname = "Microsoft Internet Explorer" & bversion> = 4 )){
If (bname = "Netscape "){
Brows = true
Dt = 1
}
Else {
Brows = false
Dt = 40
}
VaR z = 0;
VaR MSG = 0;
VaR RGB = 0;
VaR status = true;
VaR updwn = false;
VaR message = new array ();
VaR value = 0;
VaR timer1;
VaR timer2;
VaR timer3;
VaR convert = new array ()
VaR hexbase = new array ("0", "1", "2", "3", "4", "5", "6", "7 ", "8", "9", "A", "B", "C", "D", "E", "F ");

// Modify the following content

VaR bgcolor = "# ffffff"; // background color
VaR color = "# 0000ff"; // font color
Message [0] = 'Welcome! '
Message [1] = 'with your support, I will keep improving'
Message [2] = 'here are many JavaScript examples'
Message [3] = 'web http://www.7wind.net'
Message [4] = 'if you want to become a master, please sit down! '
Message [5] = 'Contact me if you have any questions'
Message [6] =''
Message [7] =''

// Put here your own messages. Add as alias as you wan't (do not edit anything else in the script doesn't the lines above)

For (x = 0; x <16; X ++ ){
For (y = 0; y <16; y ++ ){
Convert [value] = hexbase [x] + hexbase [y];
Value ++;
}
}

Redx = color. substring (1, 3 );
Greenx = color. substring (3, 5 );
Bluex = color. substring (5, 7 );
Hred = eval (parseint (redx, 16 ));
Hgreen = eval (parseint (greenx, 16 ));
Hblue = eval (parseint (bluex, 16 ));
Eredx = bgcolor. substring (1, 3 );
Egreenx = bgcolor. substring (3, 5 );
Ebluex = bgcolor. substring (5, 7 );
Ered = eval (parseint (eredx, 16 ));
Egreen = eval (parseint (egreenx, 16 ));
Eblue = eval (parseint (ebluex, 16 ));
Red = ered;
Green = egreen;
Blue = eblue;

Function start (){
If (bname = "Netscape" & bversion> = 4) | (bname = "Microsoft Internet Explorer" & bversion> = 4 )){
If (brows)
Res = Document. Layers ['texttanim']. Top
Else
Res = textanim. style. Top
Updwn = true;
Timer1 = Window. setinterval ('up () ', DT)
}
}

Function stop (){
If (bname = "Netscape" & bversion> = 4) | (bname = "Microsoft Internet Explorer" & bversion> = 4 )){
Window. clearinterval (timer1 );
Window. clearinterval (timer2 );
Window. cleartimeout (timer3 );
}
}

Function breakf (){
If (Status ){
Window. clearinterval (timer1 );
Window. clearinterval (timer2 );
Window. cleartimeout (timer3 );
Status = false
Return;
}
Else {
If (updwn)
Timer1 = Window. setinterval ('up () ', DT)
Else
Timer2 = Window. setinterval ('down () ', DT)
Status = true;
}
}

Function up (){
If (Red If (Red + 15) Red + = 15;
Redx = Convert [Red]
}
Else {
Red = hred
Redx = Convert [Red]
}
}

If (Red> hred ){
If (red-15)> hred ){
Red-= 15;
Redx = Convert [Red]
}
Else {
Red = hred
Redx = Convert [Red]
}
}

If (Green If (Green + 15) Green + = 15;
Greenx = Convert [Green]
}
Else {
Green = hgreen
Greenx = Convert [Green]
}
}

If (green> hgreen ){
If (green-15)> hgreen ){
Green-= 15;
Greenx = Convert [Green]
}
Else {
Green = hgreen
Greenx = Convert [Green]
}
}

If (blue If (blue + 15) Blue + = 15;
Bluex = Convert [Blue]
}
Else {
Blue = hblue
Bluex = Convert [Blue]
}
}

If (blue> hblue ){
If (blue-15)> hblue ){
Blue-= 15;
Bluex = Convert [Blue]
}
Else {
Blue = hblue
Bluex = Convert [Blue]
}
}

RGB = "#" + redx + greenx + bluex;
If (brows ){
Document.layers+'textanim'%.doc ument. linkcolor = RGB;
Document.layers+'textanim'%.doc ument. vlinkcolor = RGB;
Document.layers+'textanim'%.doc ument. writeln ('<PRE> <P class = "Main" align = "center"> <font color = "' + RGB + '">' + message [MSG] + '< /font> </P> </PRE> ')
Document.layers+'textanim'%.doc ument. Close ();
}
Else {
Textanim.doc ument. linkcolor = RGB;
Textanim.doc ument. vlinkcolor = RGB;
Textanim. innerhtml = '<PRE> <P class = "Main" align = "center"> <font color = "' + RGB + '">' + message [MSG] + '< /font> </P> </PRE>'
}
If (z <19 ){
If (brows)
Document. Layers ['texttanim']. Top-= 2
Else
Textanim. style. postop-= 2
Z ++
}
Else
{
Updwn = false;
Window. clearinterval (timer1 );
Timer2 = Window. setinterval ('down () ', DT)
}
}

Function down (){
If (Red <ered ){
If (Red + 15) <ered ){
Red + = 15;
Redx = Convert [Red]
}
Else {
Red = ered
Redx = Convert [Red]
}
}

If (Red> ered ){
If (red-15)> ered ){
Red-= 15;
Redx = Convert [Red]
}
Else {
Red = ered
Redx = Convert [Red]
}
}

If (Green <egreen ){
If (Green + 15) <egreen ){
Green + = 15;
Greenx = Convert [Green]
}
Else {
Green = egreen
Greenx = Convert [Green]
}
}

If (green> egreen ){
If (green-15)> egreen ){
Green-= 15;
Greenx = Convert [Green]
}
Else {
Green = egreen
Greenx = Convert [Green]
}
}

If (blue <eblue ){
If (blue + 15) <eblue ){
Blue + = 15;
Bluex = Convert [Blue]
}
Else {
Blue = eblue
Bluex = Convert [Blue]
}
}

If (blue> eblue ){
If (blue-15)> eblue ){
Blue-= 15;
Bluex = Convert [Blue]
}
Else {
Blue = eblue
Bluex = Convert [Blue]
}
}

RGB = "#" + redx + greenx + bluex;
If (brows ){
Document.layers+'textanim'%.doc ument. linkcolor = RGB;
Document.layers+'textanim'%.doc ument. vlinkcolor = RGB;
Document.layers+'textanim'%.doc ument. writeln ('<PRE> <P class = "Main" align = "center"> <font color = "' + RGB + '">' + message [MSG] + '< /font> </P> </PRE> ')
Document.layers+'textanim'%.doc ument. Close ();
}
Else {
Textanim.doc ument. linkcolor = RGB;
Textanim.doc ument. vlinkcolor = RGB;
Textanim. innerhtml = '<PRE> <P class = "Main" align = "center"> <font color = "' + RGB + '">' + message [MSG] + '< /font> </P> </PRE>'
}
If (z <38 ){
If (brows)
Document. Layers ['texttanim']. Top-= 2
Else
Textanim. style. postop-= 2
Z ++
}
Else
{
If (brows ){
Document.layers+'textanim'%.doc ument. writeln ('')
Document.layers+'textanim'%.doc ument. Close ();
}
Else
Textanim. innerhtml = '';
Window. clearinterval (timer2 );
If (MSG <message. Length-1 ){
MSG ++;
Z = 0;
If (brows)
Document. Layers ['texttanim']. Top = res;
Else
Textanim. style. Top = res;
Timer3 = Window. setTimeout ('start () ', 100 );
}
Else
{
MSG = 0;
Z = 0;
If (brows)
Document. Layers ['texttanim']. Top = res;
Else
Textanim. style. Top = res;
Timer3 = Window. setTimeout ('start () ', 2000 );
}
}
}
}

// Done hiding -->
</SCRIPT>
2. modify the content in <body ***> and add the following code to the original <body ***>.
Onload = "Start ()" onUnload = "Stop ()"

3. Copy the following code to the "body" area.
<Div id = "textanim" style = "position: absolute; left: 10; top: 50" onclick = "breakf () "> </div> <layer name =" textanim "Left =" 10 "Top =" 50 "> </layer>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.