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

|
网页之跑马灯文字特效
//修改宽度
0 d+ V7 P& _# u( h" I9 tvar marqueewidth=3004 F9 B, Y: c5 s4 |) ~
//高度
. @2 o8 Q6 q7 ]" H X1 X6 evar marqueeheight=25' c7 I' h. y9 R& C9 {4 \+ b: `
//速度(1-10)
, k# j1 F. _) `1 s; i( qvar marqueespeed=3& I& C1 u! u, l2 H' {* E7 e
//背景颜色
t+ Q3 @3 I+ p; qvar marqueebgcolor="#FFFFFF"/ w y2 _, T+ A
//是否能暂停 (0=no. 1=yes)?
! r( A+ v+ Y2 b4 { ? mvar pauseit=15 n0 r6 a- @. y9 A, ?
* X5 k0 F' x. ~) ?7 l7 B1 m
//修改显示内容6 U1 [0 E B0 g3 Y! ^2 b4 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: b: _* V' ^; I9 ^9 h: L( x) m3 `7 G: W" n5 [# b* t: M, M7 j
% G1 p2 ~; e) y8 P: U$ F" i# M: Z, D////下面不需改变////////////: J }2 B$ Q: s! x, s
$ k/ E' k) K$ U4 i' Mvar copyspeed=marqueespeed
2 B9 j" W2 i9 `1 Qvar pausespeed=(pauseit==0)? copyspeed: 0: W$ C% S) h0 N$ M" i# q
var iedom=document.all||document.getElementById
; m) W; _) @1 h2 Sif (iedom)7 d/ t! _9 G! X% c7 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 `3 b) L% H0 [# q8 _! s
var actualwidth=''
0 E5 c- y2 G- {* I' x7 A0 gvar cross_marquee, ns_marquee
* i! Z: d- v# N7 U; \
( P, C' o( @' a: ifunction populate(){
# o% }1 d" I4 J9 [$ A. `+ fif (iedom){
, X H; u/ b! U# b' Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ f- E0 Z! U$ x! ^; r8 c
cross_marquee.style.left=marqueewidth+8
8 I- b1 y. L% F; a/ S3 |3 a+ ecross_marquee.innerHTML=marqueecontent
# u. l1 j$ }7 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* `* p: a) d- l% @/ }9 x' q) p% r
}
# B- O0 Q" b Y$ }* _& z6 Zelse if (document.layers){" u+ a3 P9 E0 _! d, C5 h8 e
ns_marquee=document.ns_marquee.document.ns_marquee2
, b( O% k, K4 cns_marquee.left=marqueewidth+8
: h1 \, p- S. y. ^ns_marquee.document.write(marqueecontent)
: n2 ~+ n1 K6 K) ?8 Rns_marquee.document.close(). \' F8 _* ~0 [" A& ?6 W6 z0 B o/ b
actualwidth=ns_marquee.document.width u* ^ @) x& S+ {. {3 X
}6 c+ k8 V: Q, [ m" W
lefttime=setInterval("scrollmarquee()",20)$ L/ c) l, R/ c: i; F- {6 i
}/ \+ [+ @* q/ y, M, Q
window.onload=populate* ]- e4 Y8 J, r) M- g1 w# _; E
X: H3 U4 V) g8 O+ Tfunction scrollmarquee(){. `2 i: F) T7 O! \3 {
if (iedom){
. x; S! G" S. I/ v; qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ \, n5 v: F/ [& [# |1 X# ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* l# M% H' [+ R* e* R* ~# U2 |
else
' X$ N$ c9 M+ |, M1 x2 n" A" ucross_marquee.style.left=marqueewidth+8
- x# @$ I0 Q6 n6 [0 }, {% N6 }
3 d0 C' z' B1 y# l; `}
+ x! c% D: H0 h, ^9 Zelse if (document.layers){8 ~1 D& L- g! c5 c$ b' |
if (ns_marquee.left>(actualwidth*(-1)+8))) m9 Y& N- W1 w# F" I0 n; r# N p- ~
ns_marquee.left-=copyspeed
$ f- m& K* P( w8 s: U. I l6 \* felse( T5 v5 q- R* s7 S
ns_marquee.left=marqueewidth+8
& _; |1 n. j# B}
9 N! e# Q1 u# ^! `8 k$ Q `4 C) @}4 G# ~: v+ {3 H! l( B( B) [1 F5 G
% d p6 {7 W# {1 @3 f. w2 ?
if (iedom||document.layers){- C( B* F, K2 {6 h+ d8 X. v
with (document){4 w, h% t5 O% O, g- t1 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 `5 A U# I, d! L4 l! ?
if (iedom){
: u- u2 X4 T+ A! z- C. A0 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ~5 q4 U' @1 {& S4 r/ l; p' p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ c" I$ r2 w9 t. r: \3 a$ o# Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 S% h4 N. N6 D" i4 G% P9 X5 ~
write('</div>')
; p" E% [; S8 D/ n# k( d1 u}
" V5 V& W' Q' o9 L0 helse if (document.layers){3 u1 {9 K0 {0 y. C8 l4 y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 h& l J0 u5 I7 R2 R3 n& wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% ]4 g+ _9 z6 k9 |0 B6 X6 N+ _write('</ilayer>')$ x' o- Q3 c9 u
}& t" @* L! ?) e! l c/ b. S& |
document.write('</td></table>')7 L$ @' T+ S G) \+ |; e4 K
}
# f, D3 l" ]; ?" w7 C: @}
1 T6 b% G+ q5 Z6 x</script> |
|