返回列表 发帖

网页之跑马灯文字特效

//修改宽度; p2 Y; F  t6 v! ^
var marqueewidth=300) U1 Z& e, U9 B& |
//高度9 A. M  {+ F( Q8 r! l8 t& B
var marqueeheight=25
. F- Z. V+ B7 ~: `! r//速度(1-10)
' i; g' T* w/ [. u3 c4 [var marqueespeed=3) J. Z: n1 r. y0 N3 _2 E8 @3 H9 d& O
//背景颜色" P. ]! {$ D- x( G; S0 {, R0 V* x+ z
var marqueebgcolor="#FFFFFF"1 |! i0 p( ~; b* [: @
//是否能暂停 (0=no. 1=yes)?5 z, N1 n( |. z1 `( s+ Z& T" w
var pauseit=1
0 B: S1 z& V, o) M) u( u3 e: Z) w+ G
//修改显示内容) ~$ M( i0 A* @3 H; {6 b6 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 q2 V- Q8 w5 q* h+ t5 V

2 g' d% @) A. S8 S6 q, z' p5 N2 q: X! [; q( F' W2 p+ h
////下面不需改变////////////
% \5 `! R0 Y( ^& b/ H7 y# [3 t8 w' `; K4 r2 Y9 I- g4 b
var copyspeed=marqueespeed
0 x4 m- }" c- [+ r: v, |var pausespeed=(pauseit==0)? copyspeed: 0, Y0 b0 b" J! ~
var iedom=document.all||document.getElementById* F- a* M4 ?2 P$ N6 {- A4 ^1 q- F
if (iedom)
0 I( A8 }5 F2 e& V" j3 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- k& H% `9 O2 t5 A5 Wvar actualwidth=''' y) {4 o8 ~3 b5 G. q" C
var cross_marquee, ns_marquee
  B. A( G* V$ h5 v. R& A$ w1 V* N! D) `& C
function populate(){
( b. A% D8 e) u5 Q$ g5 k$ h7 bif (iedom){
0 P* }5 h9 _- s; d+ g) |. Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: T- o% S& t/ D& T+ M& fcross_marquee.style.left=marqueewidth+81 t8 o, S1 W) M+ G; P" ?
cross_marquee.innerHTML=marqueecontent3 F: \' X( O  L* V( A( F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( R% d3 r9 @+ |9 E- J4 S5 p}
, g: E3 F# _2 x8 q! @$ v, Celse if (document.layers){
  }% A6 W9 @% z) `ns_marquee=document.ns_marquee.document.ns_marquee2
7 S3 F8 ~3 h+ c+ ons_marquee.left=marqueewidth+8; s% Y1 _3 `, Q) z2 j2 |
ns_marquee.document.write(marqueecontent)
2 J+ ~( f" q) `! i# Zns_marquee.document.close()# M( V* \7 P% V1 F6 l
actualwidth=ns_marquee.document.width
+ j' u+ ~) H4 a, i  s}
7 G2 `1 [! {5 j7 clefttime=setInterval("scrollmarquee()",20)& g$ \* m# w& Q
}1 C, k+ k" b7 ^3 T9 G+ }  I
window.onload=populate$ s6 F, U+ U1 P) H4 Y9 _+ J
6 r4 t- z1 ^9 {) B
function scrollmarquee(){* C% g& t1 S+ _5 P% k
if (iedom){; t) a6 Q; Z9 [" |! n5 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' @+ e/ k! ~6 l. V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* c; x- ?- @7 ^3 v
else
( C* c6 `/ ]6 b. n/ e' s/ dcross_marquee.style.left=marqueewidth+8
* n  G! f. t% ?- b
" @' }( k: ?; x, Z( X% u}8 _/ b; _5 G  n/ A/ u! S
else if (document.layers){
. E9 M) C4 ^3 t/ ~: d2 u; f% Pif (ns_marquee.left>(actualwidth*(-1)+8))* b( z4 H0 b5 ~% p
ns_marquee.left-=copyspeed
" Z$ e- p; ^# F/ _else# }# K* F& m) x
ns_marquee.left=marqueewidth+84 K2 G; g" y% v" I; P0 Y
}
& ~& }7 j: I" Y5 S& ~}
% N% |- X* d0 o
% c/ G* U. N% Z, Z1 @  B% Lif (iedom||document.layers){- G9 {9 M& h. D% K5 k
with (document){
; U  X/ L( @, j1 Z6 wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" Z/ l+ Y8 c# `9 _' Hif (iedom){7 \! r( B  B$ D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( t* @- p0 f5 g7 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( S0 {" b% k/ W+ ^/ I5 F: Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); C; @" N+ s: S- p8 T: ]. ^
write('</div>')
5 y1 c$ V4 L" U$ f9 m}
+ v+ Y& r& _* o+ gelse if (document.layers){
; J) J/ H0 o* R( S/ D" i7 j4 V4 Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 E$ R4 j% h! O) s( C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 L) b8 t( R% Z1 F6 y5 U
write('</ilayer>')/ ?0 ^9 d& w4 _  D7 b5 Q
}; J/ g* e) A% O
document.write('</td></table>')
" d4 V  F" `4 w; Y}# w) X% o8 K$ H6 J5 k5 {
}
& t! B* _, j6 q+ w: f1 ^  g</script>

返回列表
【捌玖网络】已经运行: