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

|
网页之跑马灯文字特效
//修改宽度
4 k% h( l3 ?8 |+ E/ b- d( M$ Hvar marqueewidth=300
7 u/ N2 Y& C7 t9 b; q//高度
1 Y1 t2 z4 H! Q. |+ v$ a/ rvar marqueeheight=25
, W* z4 J+ { F4 }1 W) ~& ~4 K//速度(1-10)
4 Z& N4 x3 Y9 f$ v. m: P: Qvar marqueespeed=39 C' w8 i- Z1 ~- d
//背景颜色, \1 z; G+ @, V: c2 X8 h
var marqueebgcolor="#FFFFFF"7 _: n5 Y" W, {2 g Q; ^
//是否能暂停 (0=no. 1=yes)?. f; q- h$ M: G: B" e
var pauseit=1# {+ F" i' H7 |. s0 M+ e3 X8 I
: b# M3 o" H7 T; I. {6 F I//修改显示内容5 H1 O+ G7 V s; e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( H5 ]/ B& l6 {, U& L2 V; A9 O; R; s6 K6 T w q
( w' t; ]1 l' e; p
////下面不需改变////////////
! ?4 p) F2 z9 A* r2 N
+ g) _& w1 L) D9 W2 ~- Pvar copyspeed=marqueespeed* K0 X- N0 p8 G# R& V, L, O" V
var pausespeed=(pauseit==0)? copyspeed: 0+ D7 R- j0 M) Q, u. i6 T6 f
var iedom=document.all||document.getElementById
0 [8 z+ ]1 x" Aif (iedom)$ m+ i, Q0 k' d- s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" [# O5 U# u; q5 t* P: ~var actualwidth=''/ C* ~4 \4 S) o: G
var cross_marquee, ns_marquee$ X0 g% K3 |4 `. g J3 _# h7 Z
5 h$ o4 d1 i% x$ \. J' Hfunction populate(){7 A. ^: ]9 R0 b
if (iedom){$ E& G8 h) O. `6 H# E z8 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. v, {7 t, O! |* C7 ^7 Y
cross_marquee.style.left=marqueewidth+8* Q8 C+ k- C& B; g1 C: I7 o e
cross_marquee.innerHTML=marqueecontent
o, ]: x! E9 E: l* j; {2 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! `. b1 Q/ H# `6 T
}
. `. c2 R0 s E* Z% Oelse if (document.layers){& R9 T/ i' f6 d9 i
ns_marquee=document.ns_marquee.document.ns_marquee2
& q- u3 Y5 E2 k* E. z" m) H2 W3 x) Ans_marquee.left=marqueewidth+8, v y$ M7 w! a6 I
ns_marquee.document.write(marqueecontent)# D7 ]* O: V8 v% \4 N
ns_marquee.document.close()* t$ C/ t4 \1 W3 b/ B
actualwidth=ns_marquee.document.width
# v$ K l% |) P}
c7 @ C2 J% B+ r& {/ X, rlefttime=setInterval("scrollmarquee()",20)
9 c! V7 Y) g) t8 x, B4 ]& J9 u}
( ]1 Q( i% M# Swindow.onload=populate
9 q# p% U7 m; A- {; m# ] V7 C. D# ~8 H/ Z% ?3 w+ ]+ }
function scrollmarquee(){
- j/ k$ K+ q: M ?. |( ~if (iedom){
# [" h! f3 s( w& {% I# V, wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) D% J5 y2 \' v9 Y' F! F7 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ u7 z3 c" P9 ^+ M6 m
else/ R* h) w+ q+ r7 q y
cross_marquee.style.left=marqueewidth+8) e2 Q8 d1 R, |: u* z) Y( o- y
' P0 M7 l2 p( E: p4 x/ T
}
0 z/ ?. H% R# ^4 {2 |+ Eelse if (document.layers){
7 }8 j* @( F+ I* t9 O3 c) sif (ns_marquee.left>(actualwidth*(-1)+8))7 E; H; }- A. ^1 C
ns_marquee.left-=copyspeed
4 }/ w* W. x1 \' J3 w! b, G; @else
% o3 z- h. j- n1 ]: x5 r5 lns_marquee.left=marqueewidth+87 ?2 i6 q% `) o) g% ?* U) Q
}& V0 P# C, \: w+ V2 r* S* _) M
}, z6 K' o; ~* m( s: _. q
! x6 m' C* h, b
if (iedom||document.layers){
5 C2 w4 X7 u% w q6 T7 a) r- p6 gwith (document){
5 e- ^: X* e+ B0 L' Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ ]" q4 X! U4 Y& T1 R" j
if (iedom){; L ]+ S, l& D: \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' c5 P% _; A$ \; `! m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: j+ l, K1 v/ l/ n+ Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 N' O( B9 b4 B" |' O" m' d! Iwrite('</div>')
3 o f" `6 V. Z" @- q& V}- q6 @: j3 ?3 E& y0 e
else if (document.layers){" m4 d" }7 W: C' n' u/ K& \" p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ }' U& x& {3 n" o' mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* j2 v! X3 G& `5 J+ b( h/ K
write('</ilayer>')
9 b( w* S' P7 b$ E! J2 X4 U& t}
4 l' l2 s0 U* J# ndocument.write('</td></table>')
) C t# s1 I5 N# `}
, T* A; q, |' w* r9 F}+ P6 g! [8 N$ U: |0 L) V" }& U
</script> |
|