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

|
网页之跑马灯文字特效
//修改宽度* ~- ]$ o* K5 b, m, C& ]
var marqueewidth=300
2 @& @+ S" b4 Z) U/ \, n7 X* @5 b4 `//高度
, F: L, L3 L/ C2 w, bvar marqueeheight=25
, U% v5 ^4 K, h; V( l6 C c6 F- @//速度(1-10)& h) }5 }7 D/ w. Q" q) g! U
var marqueespeed=3
2 f0 V6 B; O! S L; Z2 O# C//背景颜色; p, L( N- g( v' B: `3 L; u" ^
var marqueebgcolor="#FFFFFF"
5 ~ Y+ _+ Q) _0 s/ [, @//是否能暂停 (0=no. 1=yes)?
) g+ Q7 P0 ^4 `var pauseit=1
- e+ Y) t( I6 E3 j5 N' k4 l1 C& t8 c. _. q9 p: V( k/ P( w) X- s! K
//修改显示内容
) q- U8 n! z- l" Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 X3 N. `, s+ ^+ ~% q/ D
) Z8 r0 T* |0 d' X4 U' h) A' `% q& q
- g" `9 h t/ W' ^4 D" S: A////下面不需改变////////////
! ~- p) F5 q- }) ~6 G& ^; b
8 Q3 f# E" z" g2 q6 ^, g1 Uvar copyspeed=marqueespeed. Z# z% @( H' y# _3 `
var pausespeed=(pauseit==0)? copyspeed: 01 d ?+ S- z9 m$ w1 a7 e# l+ O' M
var iedom=document.all||document.getElementById
: s& | y! w6 v% gif (iedom)' q0 o! \7 B' K4 g. Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) e) O( t4 A2 g- W# |
var actualwidth=''/ M: F1 I3 K$ J) m# S
var cross_marquee, ns_marquee
5 z6 J' d$ `( w2 F+ @7 h
/ x! Z, t& q' U2 Xfunction populate(){/ q j$ a: E" W6 i' X
if (iedom){
0 N- r1 D/ ]3 t: B. _3 H7 Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- a4 @! r+ [) E" U4 hcross_marquee.style.left=marqueewidth+8
( W! x5 t, y7 U5 K$ a' Rcross_marquee.innerHTML=marqueecontent* ^3 s+ J2 @; j" J: _$ q3 w- d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 S4 [1 p! F! ^( X. Y
}
) ]1 V. R9 m! e! i7 l& ]else if (document.layers){; V3 b/ ?0 n0 V5 ^: Z7 m
ns_marquee=document.ns_marquee.document.ns_marquee2: ^( P1 b3 Y. Q8 N' n
ns_marquee.left=marqueewidth+8" _3 g# z6 h) N, T' _
ns_marquee.document.write(marqueecontent)) ^$ J0 J, y; N1 }$ A% L" }
ns_marquee.document.close()" ~% g5 I9 G4 K5 [' x# c
actualwidth=ns_marquee.document.width6 a1 {3 ?& v$ s* Z% D6 ]
}& F9 X4 t: p5 A, I8 W8 k$ {$ ^
lefttime=setInterval("scrollmarquee()",20)' O$ u5 u2 s. Y
}6 ^6 U# |% m4 C2 {/ p
window.onload=populate* d9 a) M1 U/ f/ ]
4 P* c. f* ~& O* {: V! ofunction scrollmarquee(){
" z' l. @! h0 E" Aif (iedom){! R' k2 j7 c' f0 ]# I \* S! g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' E0 Q) k' b9 \, {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- B. A5 }4 x! W1 O; }
else
3 U1 [4 ^6 j' B1 T) hcross_marquee.style.left=marqueewidth+8
+ Q& i0 X6 h" V- ?1 f# D5 I
( S7 @& l( i m6 H6 f, W}& T1 v* J0 G/ \" F) e$ y. l
else if (document.layers){8 O% T+ a& | J6 Y
if (ns_marquee.left>(actualwidth*(-1)+8))
* ^, l1 W; l8 M+ p* m: k% D( o$ Lns_marquee.left-=copyspeed
* o1 c2 `- c5 I0 l' I: o' Qelse
1 Y# q! R/ n6 C* Sns_marquee.left=marqueewidth+88 ]: ^& J0 b* M7 e" ^! n1 K& l6 X
}! M9 P% C7 b" |0 u4 [
}
6 _% h( m, ?4 Q2 J6 b4 M5 s) U" r% o( J
if (iedom||document.layers){
5 h/ m3 G0 A+ i" V8 ?with (document){
8 w# C" [$ P' \* h6 O. {' D; g* @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ P* D3 [$ y, V# F5 b0 A
if (iedom){* z P0 t4 E, _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 [& u; V0 ~. ^9 w6 D p6 } |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# _) l6 K1 Z8 \* q5 ~' v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% N% I. m2 q7 O
write('</div>')* S0 v, Y# Y. v0 e$ z* q
}
- d5 P3 N' }1 W8 v" n6 Helse if (document.layers){
9 }% h# B. i2 e! qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 g; b+ u. J+ L$ z" H3 t1 H8 I, S& C" {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ~5 m& S. R# Y2 G U
write('</ilayer>')
# x6 U1 B" T8 i' k}
, k" N! N: ^0 L6 k" Ddocument.write('</td></table>')" l1 N' h+ H) A$ z: r
}: \. B4 i* t; C& q, U
}# ^5 l4 B/ W) R
</script> |
|