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

|
网页之跑马灯文字特效
//修改宽度
. p6 W& i- ^. J9 U0 X+ Uvar marqueewidth=300" z% `! l+ B) O
//高度8 c& S# R, @6 G y
var marqueeheight=25* [4 L6 |# x a2 f2 I# j/ i1 j
//速度(1-10)
0 d) ^" k5 Q: f, ivar marqueespeed=3: J6 _; n5 w/ m; \2 e' \
//背景颜色) \. }1 D0 W. H% C, {, ~- f
var marqueebgcolor="#FFFFFF"
4 |/ \) I: ]; B( x% ~/ Z' \& w//是否能暂停 (0=no. 1=yes)?. t# ^! A2 Y0 a: q% q
var pauseit=1
, x# M. i% u; a- g6 y) Z% g3 \/ e. y8 e3 ?: S& F7 [9 I* X w
//修改显示内容
( W# Q& O' V* u4 ]1 x& dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' f+ s5 J6 q' X( C% [# ~) ]
* e! g: A! P! P% n& m( p- K& e9 F4 F# a+ \
////下面不需改变////////////
: G4 f5 T i$ v0 k* S% f: o" r
2 b( i/ i+ y8 ~9 D% Y Y6 _, ]var copyspeed=marqueespeed
) {" a5 k: k/ r# gvar pausespeed=(pauseit==0)? copyspeed: 0 N: Z. ^- B! I9 P0 q% F8 r
var iedom=document.all||document.getElementById
$ [) `' b8 j0 d' i; b, j3 |% t, ]if (iedom). j( W$ Y0 |& N _7 C$ c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* g+ ~1 ?, h( g) {& ~( h; w" r) gvar actualwidth=''* ~( T. P7 x3 W7 j) i9 B9 w
var cross_marquee, ns_marquee
) X9 S) E& F5 R% F$ b& a3 p3 ]7 x4 ?; U8 y* |: W( \2 o
function populate(){
6 i4 b- a. a4 o) Rif (iedom){0 w/ \& i, l' G- l' N7 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, y8 j3 m' {1 {7 u+ Q3 U0 ccross_marquee.style.left=marqueewidth+8
4 r2 U& @- G" _1 Z) gcross_marquee.innerHTML=marqueecontent- @1 I$ P$ b+ N. p% V+ Y) ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: M2 X6 L& x6 P! y% y
}
( d2 ]( H" C+ \1 I4 I: ]7 t+ \else if (document.layers){% E0 f5 w3 R1 R3 a" I
ns_marquee=document.ns_marquee.document.ns_marquee2
, @( x- @7 B5 G" Hns_marquee.left=marqueewidth+8, [/ [7 t8 j6 a2 R1 \0 w4 R
ns_marquee.document.write(marqueecontent)# w% Q' H9 \4 N7 U8 D7 z
ns_marquee.document.close()
0 M6 W0 C K. c' w9 yactualwidth=ns_marquee.document.width- c+ D+ ~) Y3 U$ Q, ~4 e
}
$ V( [& S/ W3 O" vlefttime=setInterval("scrollmarquee()",20)
% r+ u) h- k: w+ A. G) q5 q}/ r# m7 V3 P9 ^
window.onload=populate8 |& w! }7 R$ T2 y+ w& @, i2 _# R
+ x3 N" }0 k+ O4 E( ?' lfunction scrollmarquee(){
. }: [& Z+ n4 c% ~8 Q, F# Mif (iedom){
7 @. h) k a' z* \# l. ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( N$ J2 ]2 o9 n) I( U- Y! Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 a$ T, G3 ~6 @else( Y, X8 e) c+ q) H7 B) e$ ]9 C( v
cross_marquee.style.left=marqueewidth+8, p, e. {+ u) r' _! `
" |* D2 R2 f& O/ a1 ~
}. I( V) v0 S4 a
else if (document.layers){
& |$ s t$ v( I/ Sif (ns_marquee.left>(actualwidth*(-1)+8))2 O* B& s7 {3 {- j/ T3 Y
ns_marquee.left-=copyspeed
1 D x/ T' p' `else6 I: i9 I2 j( w2 I @
ns_marquee.left=marqueewidth+8
. ]3 \8 I; E9 t}
) m- r ]7 z! d; m2 P}# x E+ d7 F9 K6 m3 B% t% Z
, O7 L! i! C0 j+ g" ~8 pif (iedom||document.layers){
1 O% a1 U: H& F+ P. M7 ywith (document){
' ~/ ? J) c) Z, r! b- \1 u) Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; S! X& B, P7 Yif (iedom){
3 q. C4 v# J: L N, pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( v, d' p0 u! w. B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
]4 B. @8 G; i) a. U5 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! j1 q+ w* m0 z
write('</div>')
~9 w" J% h1 b/ O( |: B}3 b% m: S/ B& q" ]; j0 r
else if (document.layers){
5 [5 V8 u# m R8 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ U' e1 B5 r% S$ `/ h+ T! T+ p) x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* Q; R8 u; Z/ b3 `8 S
write('</ilayer>')5 c" B3 B* F) W# ^0 S
}
5 t$ b) t s7 fdocument.write('</td></table>')
) \9 m$ M, P' u7 K* A5 [}2 d! O4 u4 n0 N- R3 h, s3 e
}' d+ h# i: g5 O* S+ d$ {1 \
</script> |
|