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

|
网页之跑马灯文字特效
//修改宽度
$ b0 [5 w$ x$ D& ]9 ~. }var marqueewidth=300
% ^7 L, Q; {& \5 t# D1 |//高度
# D/ `* u$ I' O) h' q% e9 bvar marqueeheight=25
1 @5 G4 C. H( |* V8 X: \5 C//速度(1-10)) D. V: K+ X- z6 J6 z9 V2 |7 J q; S
var marqueespeed=3
E) L/ S$ f4 v* ]. X& o//背景颜色" z: a- A- J$ ?6 D) u
var marqueebgcolor="#FFFFFF"
2 h8 M: g7 B' c- ?//是否能暂停 (0=no. 1=yes)?4 p6 A& Y3 X. Q+ K6 a9 o
var pauseit=1
1 R. a: G/ a) T7 `* ~! J5 \2 d/ ]# {; ?
//修改显示内容
. x# x2 o& u# w# G; i/ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; [/ W) {: y2 |5 O1 E1 m2 S* [8 d: G# |- q& m; y5 `. v! n
1 a% ]) S- N: @1 m5 G7 I////下面不需改变////////////
( Y* Y! Z+ C- n1 k1 X) G
' q( F1 H' {- Y$ r6 R6 S1 M5 ^var copyspeed=marqueespeed$ S9 N' j9 F( r( o
var pausespeed=(pauseit==0)? copyspeed: 0, L7 r# j- T2 s) Y% H% }
var iedom=document.all||document.getElementById
3 W2 j4 N" b+ n- `( Kif (iedom)
! K6 V/ }& V# s" ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 c" e% h& ^" }
var actualwidth=''6 h, U8 C; r8 }* x: D& D
var cross_marquee, ns_marquee) q/ S9 A. F3 a% P8 x* C
8 n( B& M; X# K& r/ t
function populate(){
' g2 _& _ T9 q$ H2 X- q% Lif (iedom){
2 D! u$ B. i2 N' H' z( K# rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% f$ s) B! g$ {2 T8 w2 d# ]# P0 Zcross_marquee.style.left=marqueewidth+8
2 ]. v3 m# ~0 vcross_marquee.innerHTML=marqueecontent
1 E4 h2 ~. h: o: n# A" Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! f( J9 [& O& \6 j
}$ Z, v x- b# r) Q, S
else if (document.layers){; x3 a+ H) Z3 Z1 C" A
ns_marquee=document.ns_marquee.document.ns_marquee2/ @/ u* Z- T7 H, N
ns_marquee.left=marqueewidth+8
; c# ~# I \5 ~+ ]% Z3 H' Vns_marquee.document.write(marqueecontent)( z) z9 |) K) K: c$ j
ns_marquee.document.close()
( N( E/ ~( `3 P5 y5 N! L. Kactualwidth=ns_marquee.document.width
) s$ ]# O0 w' r6 V! _2 R8 w}! Q: W/ S7 B2 o q2 p- E2 Z& o
lefttime=setInterval("scrollmarquee()",20)5 F' f9 _. D8 S7 X
}
6 K; Q6 ~6 W! \7 r1 L. A8 P; Owindow.onload=populate+ i$ ^7 @' f+ o" C
" }0 K$ m5 I Z7 |( Z" H& E3 u0 U
function scrollmarquee(){
5 Z* _* s/ f R8 b6 p& W% E* Uif (iedom){0 E, z2 R* t3 w0 C! I/ ^' x! U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. Z# y& I& i& J0 ], B4 l4 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! e& h" }2 K; y3 f
else
# A- ^" u8 ^4 z! J. }3 d) {+ rcross_marquee.style.left=marqueewidth+8
4 V+ p" Y1 v* Q" f; Y# c0 R8 T/ ^1 ~
: z& t- M2 g2 u2 ]( m( f& t}
3 h6 B- o4 U0 f# P9 o1 jelse if (document.layers){
) O9 F0 c. T* s9 h1 U5 rif (ns_marquee.left>(actualwidth*(-1)+8))1 w, J$ {0 L) o* |! v
ns_marquee.left-=copyspeed
8 P4 ]5 p9 U" H1 a* @6 y) j, Selse
+ w$ Z0 ~1 d2 r, vns_marquee.left=marqueewidth+8
, l0 z4 R5 P5 x( q9 ^}
3 B* }, X2 ^' X}3 G3 W8 _9 @7 e& l9 d8 k
5 o( w; A) y; o, {9 x
if (iedom||document.layers){
9 `# E) @/ y( J$ gwith (document){2 P1 D6 J7 G$ w8 l% C0 R* A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 K G" `1 j3 Q* b; t5 @7 ^if (iedom){
, U6 V+ l0 [/ w( uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 M5 N% Z$ h, { \ L1 h) \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 F H+ Q2 k% m( _2 s5 p8 N* l; l3 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') k5 I- o6 e& n1 X3 K4 z
write('</div>')
?- J+ ^$ Z! ^, c+ Z' C5 c}
! T- y* V3 a+ l; pelse if (document.layers){
+ Z+ K( Z2 [2 ?3 a4 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& y t2 D Q* h; N* p8 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 u5 O3 Q/ x1 l, ]# L6 _, y7 F6 |
write('</ilayer>')
& h6 q- a( y! V; d}( W0 U- z {% f( o& O$ a
document.write('</td></table>')
, U6 W8 Q+ _. n) y}& q p7 _6 M* y8 o
}
( [' q3 [) @- Z4 ^</script> |
|