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

|
网页之跑马灯文字特效
//修改宽度
6 E/ S8 C9 ]; @8 {; Yvar marqueewidth=300! Y. T2 T6 M* c) T: Y
//高度+ C. V1 h5 }, v* O) J
var marqueeheight=25
( T( ]2 S q g//速度(1-10)
3 B/ ]7 l) A4 S9 c* \var marqueespeed=3! S! Q8 a2 z2 d- _" y* y; F
//背景颜色
) M1 Q6 x9 h9 b. }$ Cvar marqueebgcolor="#FFFFFF"7 r9 V" n; s1 b; ?' z
//是否能暂停 (0=no. 1=yes)? @ E& J5 v0 v$ I T4 {
var pauseit=1. \+ d. X P0 I9 }7 }3 L" D/ L
`$ [- M1 C$ l, T! J/ k/ X//修改显示内容
/ @. u5 U {* e" o8 j: b: c" X' h8 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' o: ?3 \+ d2 @2 Q& \2 t
$ i0 A) n6 D4 _$ B, |9 u# C: U4 z9 S" l% c9 V& k7 h# I8 z* j6 h
////下面不需改变////////////4 g p R8 O; r) G" p/ e! s
0 f3 j# m; }1 V8 N
var copyspeed=marqueespeed8 R3 M+ x- z9 F/ B7 |# }8 g' B+ m( N
var pausespeed=(pauseit==0)? copyspeed: 0
9 z) ~% S1 M/ q4 ^8 Svar iedom=document.all||document.getElementById
1 r7 b+ c* B- Dif (iedom)
4 J/ `/ ^1 j& ^: F' ~* ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 F! U8 l6 o. g/ \; u; uvar actualwidth=''8 r( @3 N+ G3 ]- R4 U5 d
var cross_marquee, ns_marquee- y( v% F8 H) U# {( J2 N4 h
+ i6 _% x- a' @0 t2 I2 ?' T. ?
function populate(){& e, K6 Z( R. Q% g5 K) L; T
if (iedom){
2 S! `- P$ H# h- @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. @: K3 D2 k+ B8 _) v2 f8 N
cross_marquee.style.left=marqueewidth+8$ x: _# T* ~! w4 T# X0 @& l, o
cross_marquee.innerHTML=marqueecontent% ~. i$ u+ N/ g# E" B: U3 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 D' {7 R' F' B, \. v8 X}9 k2 S% I0 c$ _
else if (document.layers){4 o% u7 H0 N7 J' ~
ns_marquee=document.ns_marquee.document.ns_marquee2+ `9 [* t4 l0 M7 x2 P6 M! E4 \
ns_marquee.left=marqueewidth+8( X) \) t4 D% Y8 x, W) y7 z
ns_marquee.document.write(marqueecontent)
$ X" e* t3 F! f7 `' ins_marquee.document.close(). `; M a& n3 M |. @! C% z
actualwidth=ns_marquee.document.width
( I3 [1 b g6 D' j}
1 |1 K2 s2 W8 z8 X; Dlefttime=setInterval("scrollmarquee()",20)$ h) e Y8 [7 x/ u
}- v% S" G; j# V& V/ f* ~
window.onload=populate
# K$ s$ D6 h- Q0 K
; D$ i D3 W* [2 a3 z3 z4 c% ?function scrollmarquee(){
k4 b* y+ j4 ]# Uif (iedom){
! Z: {4 G! _% d0 w* \2 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' \6 `: T6 u! ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ y+ l1 g7 ^' a7 _3 S5 U0 l
else
9 ?; k& g @1 C7 I/ o' }2 icross_marquee.style.left=marqueewidth+8
2 W0 g% W# j+ c5 D6 j6 N
; `% y0 p# q( b8 g- f$ z}( R/ X" Y! Q( F7 d2 \
else if (document.layers){! b' {' i3 {; X4 u+ l& l
if (ns_marquee.left>(actualwidth*(-1)+8))
0 e+ u* l- H. N8 O0 u) lns_marquee.left-=copyspeed, ~1 D1 m' B9 p: f: l4 q1 ]
else2 f# I/ s4 I$ I# ~. M5 k1 j8 H* H
ns_marquee.left=marqueewidth+8
6 h0 [ L7 U, C* O& v# X0 }+ ^}0 D" b& t6 @: A2 X% s
}$ L0 A7 h' d- ^* i3 D
, J, i" v( z. \5 W: _
if (iedom||document.layers){' T: `. z' x$ \ {% f
with (document){
! h6 D2 [: g" F# idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 p, P& Z+ M7 E( Xif (iedom){
, B$ G* U* T/ u0 F, ]& Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! q( _5 O l2 z8 y7 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 \1 P5 V0 M v5 Y( ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 M* [5 f) r: X7 T4 d1 U
write('</div>')
: p/ ]6 P7 a* G3 G}8 }# L# b* ?- H2 k! h! Q% U
else if (document.layers){
- G6 ~7 _& m D; l# z6 Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% V& _7 Q* S) j8 V6 t! F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# L6 S8 L; v3 Jwrite('</ilayer>')
2 Q4 R. h8 O0 j0 c0 A+ r/ S}
6 Q4 B& N2 A4 O$ g) L) Z* `document.write('</td></table>'): E/ K$ ~+ i# i
}
+ X; z2 c4 i6 F; Q$ A! Q; S}
2 y6 \, h0 K% v& p</script> |
|