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

|
网页之跑马灯文字特效
//修改宽度: R+ U T3 j- h2 y* S" _
var marqueewidth=300% b) B* @* g8 C& i
//高度2 E' W2 Z! v; `9 i7 y; l x
var marqueeheight=255 Y: y7 n2 U, O5 f! V# |, Z
//速度(1-10)
) z. h' N/ J9 k9 `* h7 Yvar marqueespeed=30 |' ~! M3 E; e6 B$ b- v) }% t
//背景颜色
! k* q6 H4 k, Zvar marqueebgcolor="#FFFFFF"( B& [% [9 g% |4 D
//是否能暂停 (0=no. 1=yes)?+ U* H- m3 G( w. k) ?' E- P( ]
var pauseit=15 G% K$ l( K6 m& M2 l- Q8 a
7 d' a' h1 ]( Z8 i//修改显示内容" [5 x9 h7 `3 R$ |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 j, N! q: Q. w7 l
% K$ V7 {0 W2 F. \! }' G& m c) |; ]
8 A9 |+ }5 p$ `" P$ {: p4 v5 R////下面不需改变////////////
2 X2 H5 A# |; o* v2 @! ^! v; p; } Z1 V, n4 Q. P( B# p5 I5 j
var copyspeed=marqueespeed
1 F" g7 s% ~% Z' J/ @var pausespeed=(pauseit==0)? copyspeed: 0
% T% E" D" x" h# N; w* Y( Q& Zvar iedom=document.all||document.getElementById
# Q: o C' g" g9 c6 f' ]if (iedom)! u+ X( d7 P/ e G( L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 P( S0 G8 |, O! y8 b
var actualwidth=''
% V( [5 t- Q# M4 W1 dvar cross_marquee, ns_marquee
3 s D, o% h5 e( }0 q- T: b- D
; i0 V5 t: M0 J7 W0 ufunction populate(){
. C5 J1 n' Y/ i0 a* r5 Y7 `. bif (iedom){: U9 s$ f1 j, ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: e( I [ T( Z( [cross_marquee.style.left=marqueewidth+8
+ p6 K' A2 G2 r: W6 G; Q' \cross_marquee.innerHTML=marqueecontent
/ q% Q5 v. q9 d* m3 A a( E" Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 Q) O8 V e* f: }}
T; [& I7 t# J8 Nelse if (document.layers){
# h8 q' l+ v( j4 ?; rns_marquee=document.ns_marquee.document.ns_marquee2, f+ g: T- l+ R8 w0 ^: a! q* F
ns_marquee.left=marqueewidth+8: h9 L9 `: j2 R
ns_marquee.document.write(marqueecontent)- C' Y: w& S0 F7 a6 `
ns_marquee.document.close()
( X. Z2 b, U0 p+ U% T! b- Vactualwidth=ns_marquee.document.width. Z6 Q8 \$ I/ @ F
}/ s) A' M' [' }- p4 W# w% r
lefttime=setInterval("scrollmarquee()",20)" x9 ] _; K3 e+ `( ?( p
}* @3 E& }+ } h7 `" V! l
window.onload=populate7 X2 y; i6 a: B0 Q2 c
6 R" d# c3 m' x+ T
function scrollmarquee(){
8 r0 n3 F1 i0 o2 N: Qif (iedom){! S+ q, \ Z* X% } [0 A9 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 f }& [0 E+ E- ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) b' e( E* ~) N2 A! X' l- h# C
else; {0 y" s) i3 ], Y @% b7 _. S! G
cross_marquee.style.left=marqueewidth+87 h3 \# _3 @) ]7 b* M) @; z0 _/ s
. ^6 [1 g. |2 R0 d" `}" j, L: m' O; T
else if (document.layers){
* A V5 e4 \. W8 f1 G1 S: D+ Kif (ns_marquee.left>(actualwidth*(-1)+8))( S2 O h3 I- e4 K6 C q! m
ns_marquee.left-=copyspeed; M* h( \: ]% g4 b( Z
else
( h; A- Y* W: J7 w5 }# S; nns_marquee.left=marqueewidth+8: b% m3 C% Z# W' u; ]' c
}8 u2 i6 Q- |4 y' C0 f/ _2 I
}
, n' e M9 G1 X1 F! c8 X+ E! S' _( p" O/ F) [
if (iedom||document.layers){$ R/ i$ H; P, V A3 u3 w
with (document){
^9 Z+ b5 \6 }% W! E5 F Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' @4 r# b0 S; I4 u
if (iedom){4 k$ o- x& `1 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 g# l) H O5 {2 z& t2 ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 H: ~' U( h7 H* m5 @' `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). J. M% T# n# R! W# h" G! r
write('</div>')4 r* e1 `, [) Y/ Y3 W. ~
}. N2 L) L6 q$ j9 M9 S
else if (document.layers){& u( d/ n! @% R _4 `$ ]: W& H' Z* ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 M- L# a4 @: T: q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* a$ D: N+ j7 E: K$ Kwrite('</ilayer>')
. Q3 C3 d& \3 g; K7 n$ |}
7 D' c" z+ j( [* o' t! V) v; C. @document.write('</td></table>')
1 g& S6 t, H' U% l& J% [0 h}2 M9 D0 g. m+ e2 M- y9 h0 E7 f6 I3 \
}
) n$ r" ~5 p9 }/ w; E' x9 M</script> |
|