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

|
网页之跑马灯文字特效
//修改宽度" k" N2 H9 x2 T- g6 u; G
var marqueewidth=300& {5 J, P7 `; `' u0 \( Y
//高度1 K6 }& h2 |& ~5 b$ X5 S# K7 j/ N
var marqueeheight=25. r0 `% }; p& m; x2 L
//速度(1-10)
+ D5 |8 E4 O6 g" G$ Nvar marqueespeed=3# F" J* k3 `5 j& f
//背景颜色+ _; n: o' _; I( ?! C. w
var marqueebgcolor="#FFFFFF"
" o1 v6 Q V+ D$ q; N//是否能暂停 (0=no. 1=yes)?8 }- p. B; u' M6 i
var pauseit=1
" l1 d S* f! l, ?6 M: v& k4 \6 s% Y- t9 e
//修改显示内容
) c( x2 y- V6 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 W0 O0 b, A( e. I5 E. d2 c3 d6 x/ Y
2 c2 M. v7 M+ d9 b. q" I4 H, x# S6 z1 Y, F
////下面不需改变////////////
# S$ a' A" I4 z' M6 @: w; @+ C. O n9 m9 |. t
var copyspeed=marqueespeed# z& `; V3 G' `3 [4 q j. Y+ q8 R
var pausespeed=(pauseit==0)? copyspeed: 0
7 ~+ i5 n3 M' W" {: L, x2 Fvar iedom=document.all||document.getElementById
7 G/ p% _: T5 E& L# W6 Zif (iedom)* p) E0 x) N& Z- H, X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: u& Z8 J% A0 ]# ?6 L8 E( [var actualwidth=''0 `" A: \+ s+ G8 [
var cross_marquee, ns_marquee. |9 u- N, a5 N
" m G! z6 h2 ?0 c3 `$ vfunction populate(){# ~7 ^ p& ]& l1 x' |" s
if (iedom){$ B* a! I$ D3 F7 P7 W5 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 V0 w) o- }: L9 n0 lcross_marquee.style.left=marqueewidth+8
5 [0 s7 e2 d( Q" l8 G T8 c# ccross_marquee.innerHTML=marqueecontent/ b- K* Z1 [) P! R$ O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& m+ h7 M% b1 \6 J) f" l2 K}* n# Y. G( }' f$ F2 K. ^
else if (document.layers){
% o3 S$ F. }" ens_marquee=document.ns_marquee.document.ns_marquee2 K2 W9 s2 R+ ]+ M
ns_marquee.left=marqueewidth+8, G. \0 U& R; O9 A& _ d
ns_marquee.document.write(marqueecontent)
- j( _* t$ N: J& w) ]" u$ i$ Bns_marquee.document.close(): T; a. G2 T' R9 ~: [+ H9 X
actualwidth=ns_marquee.document.width
& \- N' L( N( H$ t+ y: Y; w}! g$ Z2 [4 ]! h6 U& s
lefttime=setInterval("scrollmarquee()",20)
: g1 ^# v, J, K/ w}
' L3 u! _0 p. ~5 z* G+ n" }& Hwindow.onload=populate
& G2 `: Y* p( l+ h4 N3 J9 g
- v: |/ e" R( [" {( C3 U1 j6 z" Lfunction scrollmarquee(){
3 }8 f( _. ?2 q, v* E% \: `$ [if (iedom){
0 c) G3 n8 a* I7 `: mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 R4 O: F$ \8 R0 s, c' Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 k3 s6 F* n8 b6 M& Belse
! |& g/ I8 t4 |4 {6 _) M1 {+ across_marquee.style.left=marqueewidth+8' ^ }- x7 j7 ]* [5 w
0 w- y3 ^3 W, r* N3 Z! F. |/ |}0 K0 ]- S2 C) [: f
else if (document.layers){
u3 t7 W, c7 k, G. E ^if (ns_marquee.left>(actualwidth*(-1)+8))
" j' O+ h# c9 R3 B: ]4 uns_marquee.left-=copyspeed q; | v J3 l7 \5 n
else/ I, J) D- f4 t! `0 b% @0 t1 _1 o
ns_marquee.left=marqueewidth+8
8 `3 n# Q4 Y: y" L' k! m3 h& \9 \}# o& i3 A ~7 F _( e/ O- Z6 k& ?
}9 H* F1 I) B* B0 O
8 N" l# i2 r' S
if (iedom||document.layers){
+ T: ], V0 N5 ~+ t( {9 F7 {with (document){8 r8 f" X7 l9 h% p6 ~, h$ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ _& W* ]3 D2 m ~. f/ uif (iedom){
- `4 Q# @! ^" A( U$ @- twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) l( T* p" l7 x$ q& i1 K- Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& u4 r& ?$ U6 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& \; b4 _' n. s( T3 U
write('</div>')2 V. N' U& ?9 C% K0 T- r
}
( k9 ^2 R& `9 t5 ~$ Gelse if (document.layers){
* Y a% r6 F* ]3 O4 }/ r3 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 X5 ^4 d5 A, } q( s6 N. X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 l c x0 C( T4 hwrite('</ilayer>'): R v8 J3 w* h) E$ @& ^5 h* x
}
! F, m0 R0 O* d2 [0 ^document.write('</td></table>')
0 F( ?3 t' x( ]' b, O$ K}
1 M7 y1 s1 Q4 N3 f6 z5 |9 J}
# K: U- A! a) Z</script> |
|