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

|
网页之跑马灯文字特效
//修改宽度# ^ W) h. U) B, c# r; K
var marqueewidth=300
$ H+ ?4 `8 r4 Q( m9 k* E( `//高度
; p9 g6 p, _/ L, z4 b1 W" l6 kvar marqueeheight=25
* v& l f* _8 x" o% Z//速度(1-10)
$ a* y) x( O1 m+ O7 u! D& Ovar marqueespeed=3
* U9 L' @6 Z$ V0 b& `9 _//背景颜色, P+ D7 m# I4 P; {) k- z1 W/ ?
var marqueebgcolor="#FFFFFF"
6 [% y0 ^7 o4 Q* {' i& @//是否能暂停 (0=no. 1=yes)?* f$ `; l" x7 b; P) _
var pauseit=1
1 Y0 P+ p* e; L( i* S2 [# {5 z6 F* O2 ~7 u0 u1 L
//修改显示内容
9 o4 @$ F4 S0 R6 q" cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 ]+ F( U1 E3 P) ?" I' V7 E
. l: B9 |1 s9 t! B( b1 X. W
6 d3 M2 i& N; E" x4 r$ }! o////下面不需改变////////////) o( r8 l8 B3 y+ R1 ~3 l7 {3 v
8 j" k. Y+ n5 x0 fvar copyspeed=marqueespeed
5 [' R, O% k+ G) Q' _7 ovar pausespeed=(pauseit==0)? copyspeed: 0+ L [$ [+ O% X0 e- J7 w
var iedom=document.all||document.getElementById, }' Q: |# O; ~/ R3 F5 O
if (iedom)
$ Y9 Y: L1 {( @, y+ ?8 Z8 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ t3 P& P3 H0 o) z4 Z: n0 uvar actualwidth=''
$ G- X* i: p! S0 r5 Gvar cross_marquee, ns_marquee+ q$ J# b3 u5 y b O1 m) W
0 L0 y. r. t3 ^3 @0 `+ n1 _! qfunction populate(){8 n2 K* r8 ]1 H7 `* L5 F! B
if (iedom){: T6 Z$ {8 I; p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 G W8 [5 n' F: _2 U( L2 _
cross_marquee.style.left=marqueewidth+8- |9 e1 R! ^4 A& I. y7 e; Z
cross_marquee.innerHTML=marqueecontent
+ G) X# k4 ~- V3 l2 i) G3 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 n, M. o$ m! i2 h0 J8 Z2 p}' T& h5 ~4 M7 Y' D
else if (document.layers){
8 j$ r" D' L% H- g/ D0 w6 T4 Ans_marquee=document.ns_marquee.document.ns_marquee2
; `+ l8 l( o- m2 R! `/ yns_marquee.left=marqueewidth+8
4 c- [8 y# P6 W2 B' }& `ns_marquee.document.write(marqueecontent)
, r: o0 {7 r0 {# Ans_marquee.document.close()
b4 |+ o3 I+ ~ s# Z* A; W8 eactualwidth=ns_marquee.document.width
; U% g/ ]) Q. d0 P4 `8 H" h}
7 h. e3 H- y' ]4 X! x, _# Dlefttime=setInterval("scrollmarquee()",20)3 z' V4 c ~9 O1 M
}5 |) i/ ~% `$ u4 o; K. t* L
window.onload=populate
: O% [6 p/ g9 p0 C
* K: ~' r& H- n: v* e* qfunction scrollmarquee(){
" N+ a0 W5 w& S7 y& Hif (iedom){
2 x* U# \7 e! f" N- N3 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); j5 }% _! X( L s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) |7 A/ U& Q+ g
else
) I" z+ Q! Q8 M: }cross_marquee.style.left=marqueewidth+8
: J1 Q. L6 ]/ i; p* R! ~8 t& W! i# G/ T' D; s! h- d) x8 E
}
, F( Z4 N7 m, J4 W( m1 Q) H Zelse if (document.layers){7 r! |/ z( Y/ D& c$ K2 b N4 P
if (ns_marquee.left>(actualwidth*(-1)+8))
. t; d4 ~8 W0 W" j0 y0 Sns_marquee.left-=copyspeed
- S& s1 m- \( b5 Oelse
0 X7 y" k7 T& m4 J W% kns_marquee.left=marqueewidth+8 l" A$ {3 t* ]8 G; o0 `. x& M
}
! w! e- W2 L3 Z" }; ]( j( C$ ^" `}. G0 L6 n, S* M+ k- ~' a
7 m: I1 z* x% X8 Fif (iedom||document.layers){/ o# _1 K% P7 `* D
with (document){
) W* Z6 D, e2 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 m. B0 u, Q! }/ C& W! C9 q' c, Q
if (iedom){9 c u5 W, a$ g9 Q# ]7 ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 ]1 r5 @* S: \; [0 U' Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( q; Z- I* R* {. rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% q; \ e, W7 p( P& j3 r7 D
write('</div>')
' ?0 h# c2 @( s}8 P( q' U% Q U2 Q
else if (document.layers){
) W) u) e8 a+ P: Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 ] v6 h7 D* {, Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) X% ~ Z; R) L2 q! o
write('</ilayer>')
/ V" V" c7 S' m& M}
$ y" [( u- v/ Ndocument.write('</td></table>')/ j# [3 w9 n! j3 z4 F7 O
}, I2 f' n4 a3 @& ^3 L! f( J" p) W
}5 R( }6 D7 j' k0 f; l
</script> |
|