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

|
网页之跑马灯文字特效
//修改宽度
9 `5 r: w4 T' t: ?7 G7 F: i& Avar marqueewidth=300 \+ v ]( c6 z# E: J3 k
//高度9 G2 i" z D' w
var marqueeheight=25
2 M: M; v0 s8 j. z% t a//速度(1-10)
6 u/ M& m' L3 Uvar marqueespeed=3- \$ [( i/ U; U* c% W/ O
//背景颜色 m( d# ? Y, k# d2 Q9 y, o
var marqueebgcolor="#FFFFFF"
5 I% M9 s5 b3 g5 b: W' n3 q) W//是否能暂停 (0=no. 1=yes)?
0 R3 ~( d8 ~/ G0 Z5 Avar pauseit=16 i" \! }9 e: p2 w
+ o: e `: m* O. C//修改显示内容4 i, ?; D# H( ?+ s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" ^# z5 j$ o. ?2 m" t
" n5 J: Z6 W. ?3 f/ h
$ B9 z4 X, U& ~, K8 f6 p7 P4 A7 i8 q////下面不需改变////////////8 r) p( o* e# n9 ?- J' \
) Y, k- c; H9 F' |+ }
var copyspeed=marqueespeed
; X, i1 K; h+ ?" i; e s" s% Gvar pausespeed=(pauseit==0)? copyspeed: 0- b$ O) C C8 g* e
var iedom=document.all||document.getElementById. ~7 j& G1 N- l- P' }
if (iedom)* m9 @1 k4 c2 B5 O# C4 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 U0 k: Q( z+ h/ e. l
var actualwidth=''
- L3 e c0 i) i. Jvar cross_marquee, ns_marquee
" w3 [. o) Z- T5 d; m& N) Y8 [; j6 g; Z: A' Z- w# y
function populate(){
9 b* G+ x5 a9 B4 Q j3 O K c; [' y" Dif (iedom){
3 }: h4 I/ @- V$ Q1 x, L; c/ dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 i" ^& ]* k0 Q: f
cross_marquee.style.left=marqueewidth+8
& l0 u/ u. m- e4 k6 pcross_marquee.innerHTML=marqueecontent: T. j/ E: e; b% D3 R3 l5 b% g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 J2 D) `3 x& V5 [}
; H- |) j% A( p8 x2 o7 |else if (document.layers){
5 Y7 E$ u! Z% a$ t+ R7 U6 Y* Gns_marquee=document.ns_marquee.document.ns_marquee2
]8 o+ Z% O ]/ [ns_marquee.left=marqueewidth+8" q9 @6 G6 Y5 _. I4 |" {$ @+ a) L
ns_marquee.document.write(marqueecontent)+ x# o) j7 q; @5 v- V
ns_marquee.document.close()
6 F, l4 k4 l4 E! m( [( kactualwidth=ns_marquee.document.width+ \5 \# T! x% `9 I
}, l4 |$ o. C0 O2 h! j
lefttime=setInterval("scrollmarquee()",20), y3 ~* J+ C' [: _
}. V5 y6 f( z) `! x1 {% r0 F5 k% ~: O
window.onload=populate
: E0 Q# Y" X' S E! [
9 K9 i# ]& }; s( Jfunction scrollmarquee(){. w4 f+ _ Q3 s2 P& {# S" }8 O
if (iedom){0 l" M3 T7 c- s' h2 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% ?$ K, S# X1 y4 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: w9 i# s! L& Telse
& P: ~. b+ U3 h8 W8 Z: O8 w/ x; ccross_marquee.style.left=marqueewidth+8
8 Y2 [' V$ j' ^; d& N" X5 ]3 }% Q3 U' S* {2 {' v
}
8 l9 C: B) O- L( qelse if (document.layers){
, i+ s6 e- O; H- M0 J5 f0 k8 }0 \if (ns_marquee.left>(actualwidth*(-1)+8)). ^" L( G1 r7 x& w& f
ns_marquee.left-=copyspeed- e7 }! }" n6 C. X2 o5 A2 v9 N
else
! I8 \# l8 g6 Lns_marquee.left=marqueewidth+8' a" x* }6 X* _7 R3 H% n
}
3 S, }7 e9 Q* s}' Q) @$ [0 ~, v7 u0 K; L1 a
8 o* y* n3 t6 C+ Oif (iedom||document.layers){, ~3 ^% I- q+ {( v6 g' |
with (document){
+ x' ]. K- w- f! V; Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! y% @+ Z. b. Nif (iedom){
9 H. v X* S( z- }$ M% Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 V, P2 a9 a. I+ d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 q" H* Q+ z9 o- G6 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 r# t/ b$ a1 F) R8 Z, j3 k
write('</div>')
' b F% j) C, c- z' N}
# {8 \% j" j+ S' G C4 E# f# Qelse if (document.layers){, X0 n9 c+ O8 ^3 F* a2 k& A; K# \$ e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; @9 y5 e3 A$ v+ U3 D8 {" Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' F' i M/ m% T, d' s) W
write('</ilayer>')
# l2 x5 o+ M; [. x}6 N1 G% G( q3 E) F. F7 \/ j
document.write('</td></table>')8 j* S2 R/ s! s, n7 P% s9 U- x
}4 D% R1 h! g1 m% d0 {1 `" C
}
, a8 }* e6 ^8 R8 A1 M C E8 G</script> |
|