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> |