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

|
网页之跑马灯文字特效
//修改宽度' i8 j( C1 z% ~1 X1 N5 I
var marqueewidth=300" s4 d2 |3 }4 v) h8 t
//高度) [& \* w- l5 P0 m; M+ F/ r& A
var marqueeheight=256 a5 q% S# p7 D( z5 b
//速度(1-10)
' t# |3 R) y7 P5 Evar marqueespeed=3# j- C2 B' X* g" h4 z" m7 U2 s% g
//背景颜色 D; [1 f1 ^% h6 l) D+ E7 E
var marqueebgcolor="#FFFFFF"/ y' K* y; C ^) r: ^' c
//是否能暂停 (0=no. 1=yes)?
8 R" K$ ^$ Q1 p5 w, ^; K& D% Pvar pauseit=1
, h/ X- z% z* n4 ~0 K3 u' {* X9 ^4 k2 a. S9 u3 h; l
//修改显示内容
* F: X6 z0 C& _# \& s( vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ F$ ^: Y4 u- A: S6 I2 z" u' J: q; Q- J! ~" ]
: E: j; ~ _/ S////下面不需改变////////////* i! w3 j" y! u% X+ S$ V0 y! u
4 M; K/ W& d7 o% m# b$ F% ^- Avar copyspeed=marqueespeed/ [+ ^5 {9 a0 P7 H& h2 K4 ~- h9 Q
var pausespeed=(pauseit==0)? copyspeed: 0 o! q* n' P" I: T0 ?6 \ G* K4 z
var iedom=document.all||document.getElementById1 I0 e6 v2 I1 u2 @! K( C& ~
if (iedom)/ k& Q+ o7 U0 Z% }+ n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
?* R: ^' b. b4 Pvar actualwidth=''
' C. o' v, T' Q: g! Lvar cross_marquee, ns_marquee
/ ?+ l1 d5 C; L- g
2 U9 |8 p8 ?4 e' M. |function populate(){* @0 P7 b9 ^. C5 s
if (iedom){( J, A4 z+ I* U; _1 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 E7 \# Q% p; j: Hcross_marquee.style.left=marqueewidth+8 R0 f6 u3 f; T2 a4 ?: t
cross_marquee.innerHTML=marqueecontent( n* n1 x4 {. l& b7 T/ I* p& u& C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 B2 h) I8 o& l8 @% c9 D
}
# `+ N9 U7 q0 G+ s X7 ]else if (document.layers){
4 q! p1 j4 B, R' `% v O1 yns_marquee=document.ns_marquee.document.ns_marquee26 t/ s3 ]1 R9 @" V( g, T3 c; l
ns_marquee.left=marqueewidth+8
6 Q' |. f5 t' I g: V8 Y) o2 L3 w( wns_marquee.document.write(marqueecontent)
, I: Y- U" N2 H6 S5 S0 g* ins_marquee.document.close()' U5 Z; @4 m" d& R9 B9 M, X- Y
actualwidth=ns_marquee.document.width
3 m' e- F6 x, }' E7 |}' U6 g! q7 B7 Y' R# R, Q
lefttime=setInterval("scrollmarquee()",20)/ X2 K1 D6 ?/ C9 W: W/ ~+ S( a* d4 N
}
" s) c3 E1 e+ Xwindow.onload=populate+ ?( r5 h; X* @9 E0 a
e# `& A! F; n* b: O) |function scrollmarquee(){) u( @3 C7 J! ]
if (iedom){
; h5 @6 `3 s5 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" E6 [- c0 G2 v) gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ x/ c+ L) l9 p& f$ N% I" J! Qelse
3 Y$ K% ^3 n! T: G3 ^cross_marquee.style.left=marqueewidth+8
, G6 S4 n9 Z( K |/ Y
) l. ]9 k: V1 |2 A- w- p}0 y) @! k# [* K3 S6 |
else if (document.layers){" C7 ?+ l1 _; v* q) @
if (ns_marquee.left>(actualwidth*(-1)+8))
' h! ~/ L0 u# ?' ]( |2 h+ rns_marquee.left-=copyspeed; w9 K/ s0 \: [" u
else
% e& x s% H$ \. Ons_marquee.left=marqueewidth+8: k* `) X3 y h3 x# L* m+ K
}
% @, \/ z# R# O}2 A& q0 s2 Y' |7 ?& Y8 C) z* s
5 q+ V, ?7 G8 P9 Y0 w1 H' ^
if (iedom||document.layers){6 ]7 g: `& q; U+ ~$ | z
with (document){" D- `( Y0 _ i- v9 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ K0 _# A! c& Q9 d# W6 gif (iedom){
( d7 V3 Q5 w/ ]! F7 y" z/ }0 }3 D Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 m$ \1 G- R, o; M5 ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 n6 U! L$ Q1 t9 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 N4 {# k3 h! T2 d9 ?7 y
write('</div>')
9 `2 V: B- d% S& W1 i: j( p}
( P7 S; n! L# G1 W( u6 @else if (document.layers){8 }. M4 L( \1 F* \; _7 ]' j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 w0 S# p8 [% c0 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- l: W. ]& Q- x& S2 D3 c2 q
write('</ilayer>')
8 C: z/ k0 G& @/ Y}, B- V) u/ `6 X. J5 v4 `
document.write('</td></table>')
& i' P6 ?" ~, r! D$ j}
0 N" U4 Z2 W3 u3 z0 v) K; z# y}& N5 J; W# V1 g% w# d6 p1 O
</script> |
|