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

|
网页之跑马灯文字特效
//修改宽度
2 s. w3 a' n& b3 U: N: }. svar marqueewidth=300% O/ }& J$ k3 z+ H% Y! D; H
//高度
2 I; i/ L, U7 M* Kvar marqueeheight=253 r S5 E$ k1 B$ L$ v% d
//速度(1-10)
# d# i& T0 A# ivar marqueespeed=3
" g; n" u! z1 z, c# A8 U+ ^5 x/ g$ t7 z//背景颜色
3 p4 o6 c7 r4 _/ Uvar marqueebgcolor="#FFFFFF"
' f H3 M* F8 p) G" ~//是否能暂停 (0=no. 1=yes)?& E% t1 _6 S/ A" X9 c
var pauseit=11 Z/ s; y! H+ A
5 b; F& `: `5 K7 H7 q) Q- A//修改显示内容
9 r5 r. d E3 o; gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ f& }5 _- P) i! J
; l6 r0 T) x4 Y+ _) P( \) A% a# G- \6 k
2 B; f" t6 A7 ^+ Q- @# \////下面不需改变////////////
" k6 O" d; p% `9 Y' a- U* Q; m& M$ J, M- ]& t/ e& s. h
var copyspeed=marqueespeed, @( A! A8 V5 u1 V/ c
var pausespeed=(pauseit==0)? copyspeed: 06 A c+ A! q0 o+ {/ h; Q) \
var iedom=document.all||document.getElementById5 A( v% T' x* V) \" w8 ^4 L: ^
if (iedom)
* s% |; \2 j! B2 j* {+ _, Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 H" J* Q. {5 ]1 l3 o8 J6 q
var actualwidth=''! H- [0 P: T0 a1 s
var cross_marquee, ns_marquee
: ^# h, Z% s4 A/ [" S/ W3 C* N5 h# p) f: e# K
function populate(){
3 n6 F! i) @" w. |9 Q3 Z9 mif (iedom){
- m, y( y1 p' h2 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. I4 K8 w4 t; R6 S' @& K- Y
cross_marquee.style.left=marqueewidth+8
& P8 O. E. Q; W& a1 Rcross_marquee.innerHTML=marqueecontent4 ~2 J, S! n" o. A2 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 v6 J/ j( g# Q8 n& w* C}
3 Y( Z4 Q7 O4 O& p) Y8 H! g$ I1 \else if (document.layers){
( K9 b) z `7 M/ ]9 B- {3 `ns_marquee=document.ns_marquee.document.ns_marquee2) o6 S( y2 k7 Z# Q
ns_marquee.left=marqueewidth+8
6 V* R4 t/ }+ g9 Sns_marquee.document.write(marqueecontent)
) h! ~# U; q$ u9 U4 d/ K/ V* p0 o0 _ns_marquee.document.close(); u2 r% V3 u0 e: P3 E
actualwidth=ns_marquee.document.width( b% `, @1 A5 j( {! p \- ?
}! c) F2 v* E9 U: L4 f) H8 ]
lefttime=setInterval("scrollmarquee()",20)
" \0 X3 p# j$ D) u8 N* @ w3 \}
7 O/ ]" l! Y) j: E3 k# I" Wwindow.onload=populate
/ s) _$ ]8 w0 C9 s6 G4 C' S
: C! X+ G; B- z/ b, Tfunction scrollmarquee(){
" j5 B* h4 k; Q0 q oif (iedom){1 Z0 _1 v9 ^% j3 c" k6 Z* o) V6 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* u$ K. g2 [4 E/ q) M3 ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 V; T, E/ b* q$ F1 n
else
3 q. T( A& L+ Fcross_marquee.style.left=marqueewidth+82 w: D+ W \; G5 B' P+ r
1 D' s- Q$ [8 U* G+ j3 B5 U2 E
}8 {3 I8 P; n ?" T
else if (document.layers){
+ I) @$ c2 A: n- lif (ns_marquee.left>(actualwidth*(-1)+8))- X& o, E% {! ~! I# }7 X4 V
ns_marquee.left-=copyspeed; s& o/ f2 `1 A9 k, h0 i' d1 T
else9 q+ r4 B4 T% l8 m0 X8 ?6 k
ns_marquee.left=marqueewidth+82 o; ^3 x. i% z' o2 M
}
+ _7 _+ U9 p: ^2 f}* F( h$ e/ r( k9 G- b4 V0 e
- l. f8 D8 k1 N; f1 l9 ?! xif (iedom||document.layers){
) C3 I8 z0 O& E. F# A7 uwith (document){- p3 S+ A3 z6 d0 Z. l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. K% M' d3 l; l! D# Z& Vif (iedom){; g5 C8 Z A$ U0 E, K4 W% n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% C2 Q' S: w3 K7 y" u6 I8 L- l U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 K& W4 n1 Q0 w |( _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 c3 W8 Q! a6 |write('</div>'). f+ \- W. ?8 P* ?# q; Q
}/ G. h/ U' ~& I4 K2 I, f6 `
else if (document.layers){
8 k" a% f' s" A8 q) A3 f! [$ G# vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 } r& v% C; S4 k1 ^5 S4 r1 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( R+ S% ?8 C6 y% o$ U' K
write('</ilayer>')/ v4 [1 C9 H2 O+ g
}
% U [2 v$ ~4 d% P: X7 edocument.write('</td></table>')
7 m7 e* z6 o8 m% ]. x; z! K0 n}
" |5 N) V8 Q U* V, `* `7 v}( P% s; n( Z* @4 G2 M- T8 R
</script> |
|