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

|
网页之跑马灯文字特效
//修改宽度
5 F' T" c/ N) R0 R" z9 S Ovar marqueewidth=300
- d5 R. p# Z8 f" Q1 m% W//高度, D) `0 B) P3 n- s8 o) @' z1 g" H
var marqueeheight=255 V$ z3 J. p' }0 ^/ m; u& Y) d$ ]1 T- \
//速度(1-10)" ~) y4 [8 L4 l- l/ n& z& S# r3 t
var marqueespeed=3
/ B2 J, p' ^' A! y//背景颜色, t9 R5 W7 g: m# L$ f) y- }
var marqueebgcolor="#FFFFFF"5 w, A0 v3 c% c r# @
//是否能暂停 (0=no. 1=yes)?5 W$ `+ H5 m7 w4 D& R! P6 }% O
var pauseit=10 K% n- B( D9 E) `' l
C# o% p9 k' j) g7 z$ Q |
//修改显示内容
" B4 K" }4 c2 P" P5 Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& f/ \2 t1 @4 j& }6 B9 K9 }' l
, N8 l7 r& `5 y
' H, ~. O. r/ p6 }
////下面不需改变////////////% p! ~9 V6 t9 y* W4 H" B! K' Q
( n7 e3 d, t" G1 `. F/ r+ q
var copyspeed=marqueespeed0 R' G2 V5 y ?, i; e+ M- q
var pausespeed=(pauseit==0)? copyspeed: 0
/ \3 E* f+ B3 t1 j7 ]2 ovar iedom=document.all||document.getElementById
3 E: r0 y/ s9 R6 s. F* ~if (iedom)
' f* X( ^) [: L' S" m, Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) ?9 C3 a4 x$ n/ }3 ~8 Bvar actualwidth=''/ |- }% w# T$ M4 D) @$ T5 W
var cross_marquee, ns_marquee
7 {; t/ w: ^0 @, b) Q/ }
# g: [$ N7 N" y# A$ \function populate(){2 |" h H+ h" E) n4 Z4 w
if (iedom){% N( n/ F5 N. C+ `" n( L8 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, z3 l4 o- D9 Z4 t- b9 N) a2 N7 _cross_marquee.style.left=marqueewidth+8
2 I E2 x2 d hcross_marquee.innerHTML=marqueecontent1 u8 P. ~9 u' x/ j2 k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth e: y- U1 [2 A( X7 k
}
. |" r# f( ?. Qelse if (document.layers){9 U: J# ]9 ]- N
ns_marquee=document.ns_marquee.document.ns_marquee26 y1 W* o3 _0 [- U9 N
ns_marquee.left=marqueewidth+8
1 d2 Q$ s! ]$ p8 K* O# [ns_marquee.document.write(marqueecontent)
$ _+ r% L6 Y$ x- _4 O' N2 ens_marquee.document.close()8 Y' }9 i: ?4 r, j
actualwidth=ns_marquee.document.width
: y q+ o2 _2 R" B} s6 |' X: _6 @7 n J4 B( g! F
lefttime=setInterval("scrollmarquee()",20)
" b$ ?. B) j9 E! v3 C" m}* j1 X% O, i( y5 k- S5 L* y$ y. f& h
window.onload=populate
, g2 v$ s3 T+ f0 }0 Q
% Z" O* ]6 Y% J& c' cfunction scrollmarquee(){
+ W8 i5 b6 K% ?7 M3 ?if (iedom){
6 g6 R$ g" d. `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): r" z. p' j2 e0 p8 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- O$ d; x) a2 R A Eelse
. g0 |. Q0 `% S% I: D5 |cross_marquee.style.left=marqueewidth+8
( g, S. y( D6 z: S. p" H" [6 w- M; {: y$ ^8 X; ~ C& ?" e( u
}
( i+ ~# T$ h- Oelse if (document.layers){3 d" e# ^4 J8 s
if (ns_marquee.left>(actualwidth*(-1)+8))0 v* p; n! w+ x# @/ n
ns_marquee.left-=copyspeed+ n' u& G3 Z' N2 t
else6 V+ y& o( L# S1 B2 k9 C
ns_marquee.left=marqueewidth+8
; W: u( H2 q% G}
3 s H1 w: B- `# m0 H5 |( M}5 c/ X& u8 \5 `! P3 {/ h. k3 f
/ H' [5 C" d* O- r- Nif (iedom||document.layers){
) ]4 p s7 u0 }2 Z5 D6 `5 owith (document){3 P$ H. W+ v1 E# h; s+ d- m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ b5 q0 ~+ z7 t4 gif (iedom){
* S1 a6 H4 L2 _( `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% V4 g, ^) D1 [6 J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) R, s# v; ]: i1 ^" @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ Y) d' Q; e r0 Cwrite('</div>')
, h1 \7 y. F3 |, i}: [$ Y8 x( h: Z Q2 a
else if (document.layers){
1 x+ o. K! q, ^9 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* r) m! V0 i/ [! kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 w; ~! r1 c2 }- f; Rwrite('</ilayer>')
( X+ o6 S) P6 z+ [+ H- s. M$ `/ p}' r1 Z9 ~: |! L9 r% X& ?# D
document.write('</td></table>')0 I1 t( K& Q5 g( S7 m% U" C
}
/ r2 {8 \" `8 n6 @4 t# m8 e" |2 D" ]" f}
) X; L* Q. {( [7 Q5 J</script> |
|