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

|
网页之跑马灯文字特效
//修改宽度+ J5 I1 S2 G( X
var marqueewidth=300& k& E$ o I, q' J$ S& o
//高度 |5 w6 c3 e& b8 u7 t$ @, M) b
var marqueeheight=25
6 K& a" r; k% m u//速度(1-10)$ ~* m3 E6 n$ B; V% @/ ?
var marqueespeed=3
( C- y( T) u- _+ m. a) V: i//背景颜色
& c* ]7 ]1 x% k% G( v9 m) Uvar marqueebgcolor="#FFFFFF"3 {, ]7 |5 l/ Q$ ]6 @
//是否能暂停 (0=no. 1=yes)?
) `. z' V* U' h/ F; G4 O# E7 g) Y' i+ lvar pauseit=1+ L: x$ R1 w( Y3 j7 I# ^- M
" c4 L* h! u a& c& X' l
//修改显示内容
% R& t4 C& X7 I: uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 ?' t* u( z, b; D, T* c4 N6 t1 P1 t, _
% L4 f# c" E6 w- `2 {1 n. i0 G8 X
3 B5 c# w! z* L4 i( p9 g4 T////下面不需改变////////////
$ x d" n4 N' k% W. \1 B, s0 t" ~4 u$ g! c' q c
var copyspeed=marqueespeed
( Q5 g% O ]6 G# Pvar pausespeed=(pauseit==0)? copyspeed: 0
' Z2 C/ C/ r8 J8 Mvar iedom=document.all||document.getElementById
% h9 k0 n" z% jif (iedom)
' F5 M( y5 n. x5 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# E4 Y" p# ?* P
var actualwidth=''" L% V2 X4 W4 p$ S3 G
var cross_marquee, ns_marquee" A( K! X' o' i0 u, h8 d
' J2 s2 \9 } H& {6 K. B' U8 Pfunction populate(){& V1 }# V; E2 t; a
if (iedom){! S" _, S; P4 r6 `" y9 ?! J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- p/ f2 Z( A( h9 B( I5 U" o
cross_marquee.style.left=marqueewidth+8
- C2 Q; R* F: o' E! |! r" scross_marquee.innerHTML=marqueecontent
7 C# K4 u" o. V/ Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
{ P$ X/ w4 U7 L, O% ~7 q}# K; w/ v$ g* Z' [/ V+ ^
else if (document.layers){$ [' j) Q2 {+ S/ D
ns_marquee=document.ns_marquee.document.ns_marquee28 J3 q1 p; J5 q8 G
ns_marquee.left=marqueewidth+8/ J0 t4 E5 P; m( D- y$ M
ns_marquee.document.write(marqueecontent)
5 N, ~5 ]) b+ i" G3 ins_marquee.document.close()
0 e, b I; _+ ^% Z' X* B! `actualwidth=ns_marquee.document.width: `2 Q! i8 g1 O6 |: q% L5 r0 M" j. W
}
* U, J# Q0 q) Y. M) k, ^, L; @lefttime=setInterval("scrollmarquee()",20), S8 B+ b# ~/ D `$ ~2 d$ m; o% J# ?
}9 H0 z& Q; G* u: j) `& S
window.onload=populate
* v5 u5 | o0 K, g+ A! _
4 F# S5 ]; U! p" c$ n4 Pfunction scrollmarquee(){1 f" I0 U, b7 R2 P# |
if (iedom){
. b+ x8 i4 u1 R; Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
\4 G$ L2 i# d1 _5 r- w# c* `* ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 C) q0 \. e4 n1 V0 V2 G/ n
else# r1 c3 a5 G( P
cross_marquee.style.left=marqueewidth+83 M3 |! m9 t+ I4 L
2 p W0 @- c0 y! a
}. ]$ u) H% m+ b7 ^
else if (document.layers){
, A* M' J5 _* v0 j2 ?5 Eif (ns_marquee.left>(actualwidth*(-1)+8))
5 }% I6 V* d# H- v( \! k6 Tns_marquee.left-=copyspeed* r( g. X8 E5 I, J1 H! _ x/ ?8 T
else
. V. R0 g8 G7 s: M% s8 s; J8 {ns_marquee.left=marqueewidth+8
" y& ?, r# r3 h; O1 B}
3 @+ }$ e# X% d1 T) \' G}
- W2 w1 w" C* _$ b2 k
# Y: A( K& m0 C4 }; l, Yif (iedom||document.layers){
( V) m# h; i7 t/ Ewith (document){" \- x0 x: \! q& y% U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: H2 X7 m" x- Q Qif (iedom){ E# K: O: ?- b& M5 t- z1 } `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" {4 T$ e8 F6 d1 T7 ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ t. I, a, x0 |8 N4 T$ B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# U. }/ p! J% }
write('</div>')
7 E7 h2 i; V/ s, \% I) R) a}
7 F+ B- p8 r8 U1 e3 Z( C2 o1 `else if (document.layers){. d+ q" N" c$ v# k. n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 t7 k% z" R9 L/ P9 c# Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. Q; ^3 `+ M9 S: `& y. Kwrite('</ilayer>')0 K6 U% K7 F5 T* Y
}) C0 w# v/ i% l( i5 q1 g1 }$ X
document.write('</td></table>')
3 M# t, X G* u" T}# C6 k6 J1 |* U8 v1 D* y$ x
}# b: {) \4 W' Y% y- c
</script> |
|