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

|
网页之跑马灯文字特效
//修改宽度% W, g( J3 g7 b3 I; d' o* _
var marqueewidth=3009 Q- p; g! e, H; s7 X
//高度2 [3 P8 G+ o& V/ j6 \- Y
var marqueeheight=25
6 S# U- G K& H: F! S4 s; {//速度(1-10)
: n( W6 e8 n( K; B2 e# ^9 T# [var marqueespeed=3
0 C9 p" {2 B/ k4 U//背景颜色, U B! o( r2 a: m6 P! x
var marqueebgcolor="#FFFFFF"
! T, {8 H+ t3 V |& V//是否能暂停 (0=no. 1=yes)?
5 j) V% S) N4 vvar pauseit=1
/ _- w9 ^/ ~% C) z6 M5 Y' A% L k+ p& {
//修改显示内容2 a$ p( G7 ~, @8 Q1 O! Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* p+ v# P+ c3 I5 d( R5 r
$ R! `$ y) g8 k1 s5 r# x4 ]- N" C
6 d0 j$ t8 ?, O0 g3 s8 l////下面不需改变////////////4 a9 x3 Y- T+ W
' n" ] k3 w1 @2 N# H
var copyspeed=marqueespeed
1 |4 j* S4 [0 `3 u3 p* ?) Svar pausespeed=(pauseit==0)? copyspeed: 0
, z L; a0 G; Vvar iedom=document.all||document.getElementById
$ E& c% P B& }1 Y) A- l+ p( m5 Dif (iedom)1 K; l% X h2 V7 l( n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! D- A5 q- m' ~: p+ \# s7 ~2 z- vvar actualwidth=''
) c- E0 D# W3 }- a0 [9 Xvar cross_marquee, ns_marquee4 k4 e8 L9 j. o# ? `
8 m2 b. Y/ `. R) t+ I3 lfunction populate(){
# o. O! Q$ M) G( ^& oif (iedom){1 b5 J$ _ } S% p+ N5 a8 F4 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ x K9 ^# g5 q. d P' Ocross_marquee.style.left=marqueewidth+8
h2 Y& f" z L/ r- P% _# T8 xcross_marquee.innerHTML=marqueecontent0 o7 U& O. p: `" @: p5 J6 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* e3 B2 v2 `/ @6 u; R/ S}- o' v' I8 h3 h
else if (document.layers){
2 m' o/ I% C+ N; lns_marquee=document.ns_marquee.document.ns_marquee2
2 Z, M+ U/ P) o7 n8 Ans_marquee.left=marqueewidth+8
5 o% f4 S; U) Q9 }' K8 @ns_marquee.document.write(marqueecontent)
) S( r% o6 w$ } _& g) lns_marquee.document.close()9 ~" x q. k6 n% U8 m7 k5 B7 `$ J
actualwidth=ns_marquee.document.width
8 @1 m/ P- `# ?5 i1 i7 l}
/ z# k0 j0 L H; X. B ~lefttime=setInterval("scrollmarquee()",20)3 f; a v5 e5 ]. y& s% Y
}
" X& e4 W% n/ R8 O" B! f2 A4 F, Iwindow.onload=populate) _* P7 s* U* i
' }) i4 J* L* K$ V. B1 hfunction scrollmarquee(){
/ E+ q; f" j3 A8 p- `( l2 V$ dif (iedom){% \6 y% R8 a! E8 A0 x5 B" W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# _3 e6 _/ h& K. Q. o7 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# S4 L# J2 ~( ^% u
else
+ Z: {0 `5 U2 P/ q/ h# c* x* |cross_marquee.style.left=marqueewidth+8% R- P9 L) W7 j+ I9 x) u4 `
% Y. H3 k' p3 M+ i8 |: H% g( P; y+ P
}
1 X$ m( S ^4 s4 k4 K8 s" H2 Gelse if (document.layers){
1 M) O9 u7 V2 ]7 D4 o) S3 E* L" qif (ns_marquee.left>(actualwidth*(-1)+8))
( k4 j" ^$ P9 h, z. {ns_marquee.left-=copyspeed
( F* l" T, h& A$ ^2 Selse
2 n0 u9 F2 Y( f: R' Y8 ~ns_marquee.left=marqueewidth+81 H P5 L% v% J5 k, f- K/ C B
}2 T! i- A& N" S) o I5 O8 x
}
6 u; l% s6 M; Z" ~2 J, w6 Q
4 G+ e( U8 {# c3 V% Bif (iedom||document.layers){
" ^0 b. C* I2 P/ V% K, Y9 p w# n2 fwith (document){! a1 r: v7 T9 S7 E! {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 O+ j G( [$ X$ E6 y8 C e8 [) Sif (iedom){8 ]' x7 r9 o4 v' L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 K T5 g; K( R1 u6 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 z, i' X9 L( g( \7 a4 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) q/ k# s: g" g; {- R& p3 H
write('</div>')( l9 ?5 G4 }, b# n; F6 v, ?. Y
}
) j- K3 t' e0 W& _! v' S' V6 }else if (document.layers){
& N8 T; u' C% V. N0 p5 G$ b8 o5 u, Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): A) Q8 N0 X0 y" u- _2 Y( b4 a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), i$ r! d7 W9 C7 o* \
write('</ilayer>')
% v+ G) K( B* F; G! C8 }}8 ?8 T, w' }8 g u% S! g
document.write('</td></table>')8 B: y5 {4 t5 \4 d; Z1 j! G
}
: [: W* e# d5 `5 x0 Y}
! v/ U! w/ g2 ^) n8 m4 i4 D# |7 q</script> |
|