|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度$ W W- d* M* e; z
var marqueewidth=300; Q* ?5 N# R3 H* l# Z6 M
//高度1 S# c! V* A* @$ o6 q
var marqueeheight=25
% o8 b9 z% D7 t//速度(1-10)
+ y, G1 o- ~5 i8 N/ V y! s2 kvar marqueespeed=3. x- _6 q+ `6 T& k2 k
//背景颜色+ M, M4 _7 Q; K* L4 B
var marqueebgcolor="#FFFFFF": I Z! k% N' y% C1 W
//是否能暂停 (0=no. 1=yes)?
U( E( t# n" Q5 gvar pauseit=1 f$ N! T' T( k1 O2 U7 W
) [1 x2 {2 P6 H+ y N; W
//修改显示内容
& c5 I" x: L. q$ x; Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, k6 S% E$ l1 ~4 W# ^0 Q# g
- i, D! ~# w6 k* k' z3 N. v1 d& P6 }* Y B. I2 j1 m
////下面不需改变////////////$ A. P% B) T/ K; t6 O
7 _. M4 ~7 Q8 t* r) C* c4 O7 rvar copyspeed=marqueespeed0 I2 a: w+ p! b2 \* T m. m
var pausespeed=(pauseit==0)? copyspeed: 05 v8 k. u* K, k! S9 W
var iedom=document.all||document.getElementById
# d- `/ `5 t' @4 x: |) ~if (iedom)
" }( J. C4 L, k! Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% O8 O( Z3 r P+ f: I
var actualwidth=''
# c0 W. |# Y7 p. @/ k' \- _var cross_marquee, ns_marquee G9 Z% H2 j3 @% N. B' V+ m
: s9 A( C; A2 L3 _function populate(){, M' f$ x5 {' l- H
if (iedom){
5 H- \; p/ y4 R/ pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# A7 d0 L8 `' L; J0 B
cross_marquee.style.left=marqueewidth+8; n. t2 n" F( {5 Y- ?: y
cross_marquee.innerHTML=marqueecontent
8 I# g3 Y, k$ q( w$ J* ^7 z" Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 L0 l% u' S- C+ y}
) L4 Y; l( R! q* M) [3 selse if (document.layers){
: W( T1 B# S3 Lns_marquee=document.ns_marquee.document.ns_marquee2 w+ B h/ L, t2 l5 h
ns_marquee.left=marqueewidth+8
7 S% V( k5 i- q _+ t# Bns_marquee.document.write(marqueecontent)3 A7 ~3 h& V7 y- i
ns_marquee.document.close()/ t( d! I' ~) Z
actualwidth=ns_marquee.document.width8 S# a' s I' j3 I, w6 n
}, h/ c: o. B. v. u: j( Z( L
lefttime=setInterval("scrollmarquee()",20)# F# N* l3 \* V% c4 @& I3 |
}8 t5 K+ r# V/ T( N4 t( W
window.onload=populate
+ q3 f: {) A1 D% H3 P3 D
, u4 K; J, l, \1 b" X0 }0 |' R# ^* Afunction scrollmarquee(){& G5 B9 W! F M2 V
if (iedom){
3 a( _8 l% x" Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& Q! n# D/ {0 L/ zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, R* U% c4 G3 e* q& Y: o0 |/ q+ @* T
else
: H4 \; k7 [% i- w1 {cross_marquee.style.left=marqueewidth+8" ]' a$ d- ]2 h! ^, f3 m2 Z
$ K& P& L' n9 I6 Y1 h* o}
7 B2 g7 P' O% [/ D; }" Q1 delse if (document.layers){
" x$ d7 n; ?8 W) g9 \if (ns_marquee.left>(actualwidth*(-1)+8))! a' @! y8 q3 S' D- i- ^/ b
ns_marquee.left-=copyspeed4 h/ D$ t+ |9 S4 g
else
4 D8 N% F5 s. }. ~ns_marquee.left=marqueewidth+8
# w/ ^$ f* |$ ]}% N* H: e; N! H
}
: _: n7 s6 U( Q j# w3 ]
4 g4 l0 y; I2 n) W1 ~if (iedom||document.layers){
4 @- V: k" m# o/ Swith (document){" w5 S& D1 G5 M3 [" |. ^9 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 |$ n3 X. U8 I9 [) Oif (iedom){
. S1 y# v: m" n; h- E$ ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( x/ ]& r# r3 E, Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ Q/ w2 l3 n$ w! Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 B9 M4 k; {, l" O1 f
write('</div>'). h& L, b K$ k
}! j3 f) X6 k5 w* X) h7 R
else if (document.layers){
+ p* s! f; C8 |: E) e' o4 ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" \+ N( V8 M3 S3 T, M% ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), D& p& B, U, y& l& v! ]6 V
write('</ilayer>')
6 m* R, @; w: h% S) l( U}& q- w: \: V( R9 V' i. G, V2 |' J
document.write('</td></table>')0 F4 n* }) k/ N T7 F. H0 Y
}1 I# k" f8 C: _ O l4 Z2 k+ m$ U
}
. o9 o% L5 E5 S; |5 f- p$ P</script> |
|