Add or remove text to or from a webpage

Source: Internet
Author: User

Recently, my younger brother has seen such a good stuff, that is, we can set up some texts for our homepage that can be zoomed in or out. I don't want to take it out!

The code is as follows:

<SCRIPT language = JavaScript>
<! -- Begin
Var speed = 20;
Var cycledelay= 1000;
Var maxsize = 48;

Var x = 0;
Var y = 0;
Var themessage, size;
Var esize = "";

Function initArray (){
This. length = initArray. arguments. length;
For (var I = 0; I <this. length; I ++ ){
This [I] = initArray. arguments [I];
}
}
Var themessage2 = new initArray (
"Free software distribution ",
"China Computer Education News and resource site ",
"Website: xiaoguang99122.myetang.com ",
"Please pay more attention to the latest version"
);
If (navigator. appName = "Netscape ")
Document. write ('<layer id = "wds"> </layer> <br> ');
If (navigator. appVersion. indexOf ("MSIE ")! =-1)
Document. write ('<span id = "wds"> </span> <br> ');
Function upwords (){
Themessage = themessage2 [y];
If (x <maxsize ){
X ++;
SetTimeout ("upwords ()", speed );
}
Else setTimeout ("downwords ()", cycledelay );

If (navigator. appName = "Netscape "){
Size = "<font point-size = '" + x + "pt'> ";
Document.wds.doc ument. write (size + "<center>" + themessage + "</center>" + esize );
Document.wds.doc ument. close ();
}
If (navigator. appVersion. indexOf ("MSIE ")! =-1 ){
Wds. innerHTML = "<center>" + themessage + "</center> ";
Wds. style. fontSize = x + 'px'
}
}
Function downwords (){
If (x> 1 ){
X --;
SetTimeout ("downwords ()", speed );
}
Else {
SetTimeout ("upwords ()", cycledelay );
Y ++;
If (y> themessage2.length-1) y = 0;
}
If (navigator. appName = "Netscape "){
Size = "<font point-size = '" + x + "pt'> ";
Document.wds.doc ument. write (size + "<center>" + themessage + "</center>" + esize );
Document.wds.doc ument. close ();
}
If (navigator. appVersion. indexOf ("MSIE ")! =-1 ){
Wds. innerHTML = "<center>" + themessage + "</center> ";
Wds. style. fontSize = x + 'px'
}
}
SetTimeout ("upwords ()", speed );
// End -->
</Script>

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.