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

|
网页之跑马灯文字特效
//修改宽度
' T9 o F* m+ i' F) tvar marqueewidth=300! U7 ^5 u( ?3 { _+ e
//高度$ k N1 S3 g: g+ x1 r) L
var marqueeheight=25
0 D4 `' I0 z9 R2 p8 d2 G//速度(1-10)! y* p1 H Z& n8 W" q+ p5 a; _
var marqueespeed=3
0 J3 |. K8 @ u//背景颜色0 J% `% e) a. h G
var marqueebgcolor="#FFFFFF"; s! y/ [3 S L; y P
//是否能暂停 (0=no. 1=yes)?
. G) ?5 F' M" @var pauseit=1, I! T5 B0 u5 d5 F# E
, J6 r; F9 ]0 @; H A& @5 }//修改显示内容
( o) T" V& s1 F! mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 W1 Z- [9 c8 \3 Q
0 a( P, Z/ g* i. c$ a* V, g t$ v$ W, F8 q1 W- u: N
////下面不需改变////////////
7 ?* C- G3 \# ~* C/ b6 e" p8 ?- h9 E
var copyspeed=marqueespeed$ x. o% I& x2 {7 X7 F) V: p
var pausespeed=(pauseit==0)? copyspeed: 0
: _, }& U( W0 k3 N/ Q) M {var iedom=document.all||document.getElementById, p3 c* \9 T. s0 h' ^
if (iedom)
- p* ]1 F. W. c% X: Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* c. w$ O6 P n& O8 ivar actualwidth=''4 Z4 C1 N6 h& H# D
var cross_marquee, ns_marquee
1 ]/ J$ A; X. N* g9 [1 u* T7 J3 R6 F; T
function populate(){
* s* L0 ]! s' r; n5 D$ }9 sif (iedom){
a% m6 {. Z/ U% ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ L, F6 e9 I; c$ o7 V/ g, s9 W
cross_marquee.style.left=marqueewidth+8
* R: J/ R' P- w- A& Ccross_marquee.innerHTML=marqueecontent: ?7 e9 k' E5 H* ^: ^+ g) _2 K$ M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 Z; [9 ?, o- u7 @7 _
}5 k' P/ E; z( L) q7 U' Z
else if (document.layers){1 C" S. ?- j; V
ns_marquee=document.ns_marquee.document.ns_marquee2; P; y6 l% B a
ns_marquee.left=marqueewidth+8+ a- C, J. ^" j: ^
ns_marquee.document.write(marqueecontent) l3 V3 U# @& f9 a: G
ns_marquee.document.close()$ C/ {! M/ F6 ~* u
actualwidth=ns_marquee.document.width
7 M' n; j/ \+ i) X; x( T3 |}! T# V* W- M, ?. c( }2 J( f
lefttime=setInterval("scrollmarquee()",20)
- r" B7 t- x# \& l4 Q}
5 g+ E. q! B/ a( g. Zwindow.onload=populate
9 ]/ Q, l8 g9 d. N$ ] c# i; ^1 e9 ?9 X- b/ N7 ~
function scrollmarquee(){
! B' m$ Z' x/ A8 { n% ^7 yif (iedom){
6 u' b( K( Y/ sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 T5 a1 b5 s9 B, M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
l- }9 [4 ^: L7 @( jelse F9 F3 E1 R1 M
cross_marquee.style.left=marqueewidth+80 C3 x% A, R# x& U( q* {+ k- }2 M
( ~2 N1 l0 c" y}0 C |$ Z$ i* F& J7 i# ?
else if (document.layers){
% t& k* R/ z* y) I5 z: g9 vif (ns_marquee.left>(actualwidth*(-1)+8))
! M$ _5 [9 l) G2 P+ X+ Jns_marquee.left-=copyspeed
( [) a$ g3 U' }$ a) G5 k. H7 _else
+ Y' b5 n1 z$ c+ X- z, Sns_marquee.left=marqueewidth+8
- k( Q- X: Y" `+ ^}
2 u* Z: }* l$ i}
7 y7 ?$ p( T6 x$ |- [' H, r+ i2 X5 L) l1 |
if (iedom||document.layers){
# x" U& G k7 i; W3 z3 Z9 J7 iwith (document){
0 I2 e u/ f6 ^/ U/ @# K6 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 e0 Z" c# [& ~6 r% Z& ^3 w4 r
if (iedom){
) ?- o2 ]+ x1 M2 \2 |: Z8 S2 C& i! gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- j: c* O1 W. k, L' O) h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); p3 t1 e7 I% [. ~) F, @" ]: ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 @$ t |9 a( X5 ~
write('</div>')$ Q% o' Z: s$ I. [- o
}0 ^6 |' s! D7 ?/ a3 W: _
else if (document.layers){9 N2 l* K0 W- p0 R3 c# J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! X. n, p# N. S7 R# F# J- V8 vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; w7 n0 Z# N: w: A) S( bwrite('</ilayer>')! }9 @2 _6 F" d& Z3 E/ I
} R0 l/ d9 Y1 N5 v( a: K7 T
document.write('</td></table>')
8 p4 d. n7 E' V7 V2 Y7 m$ w0 A}
+ ^, X8 V: O7 h2 h}
. i/ L* R! N \1 @3 G</script> |
|