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

|
网页之跑马灯文字特效
//修改宽度
/ d# N- G: v+ Y) ^' c: Q! A) O, `var marqueewidth=300
9 l$ ^$ K* e5 l/ \: Y//高度& v! i9 o0 Z9 ?* a% H5 x
var marqueeheight=25# J( n3 T) v1 O$ J: | i+ D5 @
//速度(1-10)$ x7 c4 ]3 V2 ^
var marqueespeed=3% F8 y/ C2 R$ O, C: U& x. j
//背景颜色
1 l# W: f' x: M+ H, nvar marqueebgcolor="#FFFFFF"
$ Y5 v% [7 H I' E//是否能暂停 (0=no. 1=yes)?
' H+ j) A& j, U3 z5 Mvar pauseit=1
8 |1 \, B" y9 ?7 X9 W
# @0 o- h, A: D+ C4 a3 ]//修改显示内容
, a) c5 o; v- r0 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, j( a: \3 G X- d. j1 }+ {
0 P# w( k$ B1 m; e, i
8 d) N3 N' D9 w# L. [9 T- I////下面不需改变////////////1 h' [: e1 T; s# Y
3 ?$ T( h9 V3 _+ y* Xvar copyspeed=marqueespeed, h' m- y# b2 v' T7 \6 ^" m
var pausespeed=(pauseit==0)? copyspeed: 0
* E8 y- u5 J) p% Dvar iedom=document.all||document.getElementById6 s. `) s0 U; C% t$ c1 [
if (iedom)# o0 h% J( H, t9 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 z3 _5 a* l$ ^2 l
var actualwidth=''" K; j. m' i5 t7 p& o6 s, o5 P) N; w1 L F
var cross_marquee, ns_marquee- V0 f' B4 d! c' s2 X2 s/ ?
3 @' g' B; m( [
function populate(){7 |: s X# n5 G7 M' C% z) J
if (iedom){
) C7 x7 J- K' s. S) scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ @6 F* C' }9 u& Y3 C- Z5 y, s0 pcross_marquee.style.left=marqueewidth+8
$ T8 H& M# p' u* G9 {cross_marquee.innerHTML=marqueecontent
+ K: H% f' `( C3 u* jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! @" X' p9 _; L9 }; `}# H* U/ n6 E+ I/ d. E
else if (document.layers){
0 |$ Z9 S% u8 k, z+ u" y- z% ins_marquee=document.ns_marquee.document.ns_marquee28 \, c0 g5 Z% \4 G) ]
ns_marquee.left=marqueewidth+8" e, b# d9 }' [) m) r$ Z( ?6 c$ @1 N S
ns_marquee.document.write(marqueecontent)
$ }& [5 [2 E" T' F, \4 D5 W! Nns_marquee.document.close()9 |* g e3 W+ U/ z# O
actualwidth=ns_marquee.document.width
2 |% k# f9 \& P" I/ }}
2 o- ^# d5 F( f$ D+ c" I7 alefttime=setInterval("scrollmarquee()",20)5 D- h# h- d, E2 u( ?
}
/ Z# t, a0 C' I2 @3 g! ^' L% f& e, ]window.onload=populate
; V6 B' A$ ~% e4 e* w, A7 C0 h
* [( x3 r- C% I5 |3 ofunction scrollmarquee(){
# Y) P" D6 s) h2 f* O* m6 w. e Kif (iedom){
: ^1 t% I& n# B$ x9 `* A5 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& D0 W" T# O; g+ w; @/ c1 j/ G8 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 \1 D1 [) }8 X) J( p, a9 relse
9 s8 n6 x: n- M) b% Z: _2 a' ~cross_marquee.style.left=marqueewidth+82 }$ {; ~! U1 F0 q8 T
( c& X) z9 c5 h: {7 X! f
}0 V6 I5 w, B9 h; z( X: P0 K& n. |0 Q
else if (document.layers){3 U9 U" r* f5 A3 M# d
if (ns_marquee.left>(actualwidth*(-1)+8))
4 A+ V2 s3 c* pns_marquee.left-=copyspeed1 {0 i* k$ L& G: Y+ W
else
! \/ C) F# n9 |; d+ r# F9 ~/ ^: sns_marquee.left=marqueewidth+8
) `9 `( `) N. O! u; m9 V' q}2 @# f. ^- t, a P" ~
}
2 J' K& ]+ F% X( S2 g7 I5 e4 k% ~; h. }7 V" }( T! ~
if (iedom||document.layers){" A$ N5 q6 t* G
with (document){
0 b, ]7 x2 k5 K* I2 Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); N) p0 i, q# Y0 h P4 h% Y
if (iedom){
0 \9 v: C& {4 z, ~; [# W2 k. Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: g2 q9 e$ [3 K! O! N/ F8 r8 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 c- C3 W2 x: @$ t; b7 u- }+ x# \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* p! u# R, W1 B& \5 @
write('</div>')
4 x) n+ h9 U! E8 a$ x3 c9 W1 I' L}
6 H8 ~0 f9 F* Nelse if (document.layers){2 p# x1 W% D6 O+ M: c" I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 n3 {( v g- [0 ^2 k" E( Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 C( K" A! i. O$ N/ M( uwrite('</ilayer>')
: g" r/ ^% X; W# n Z }- B}
$ f7 q" A" |) f" odocument.write('</td></table>')4 k7 h9 K& M( e/ X
}
0 {8 n8 ~/ [- d2 W! w}
8 s ?0 u: @9 C$ y: W, j</script> |
|