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

|
网页之跑马灯文字特效
//修改宽度
* {( d1 v% V8 Z! T2 S- T5 Yvar marqueewidth=300
. |+ m* O5 t6 c# s4 S; P0 O/ z//高度
' b& B( i, o, B0 ?1 Gvar marqueeheight=25
% a3 k# W: f( ?& |5 e/ G2 X7 Y D//速度(1-10)
( o L# h* ?3 W4 v: f5 \" y4 `/ c6 I- Gvar marqueespeed=3' E( }5 D4 g8 X1 A: w A* t
//背景颜色
3 P. o; L0 w) S0 fvar marqueebgcolor="#FFFFFF"% ~5 z @) ]2 B2 M; H
//是否能暂停 (0=no. 1=yes)?
2 z- b3 j0 Q3 p( O' Svar pauseit=1
) P. b$ }- ]6 ?+ y$ \0 l" Q$ c% d1 C: z7 w; s
//修改显示内容
k6 H. D" e k2 q" g. q* G* A6 n# Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 l0 x" k; {5 u# N- P' R
, U% u4 g+ B! I* V l* z2 L5 G8 r
; _2 \$ w( q4 K, s# P5 V" S
////下面不需改变////////////) W9 \3 U) B w& ^, t
1 y8 L! U% D9 X1 u( z6 dvar copyspeed=marqueespeed
, |( I w9 @+ b2 d! _var pausespeed=(pauseit==0)? copyspeed: 0* V# W- K. z; \; D4 c0 U
var iedom=document.all||document.getElementById1 `% o, _* i$ `
if (iedom)* i3 d7 S- @$ _1 V0 F& u6 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. _2 V+ I, U& Kvar actualwidth=''( z5 C3 X0 h7 I
var cross_marquee, ns_marquee! B: y% t% j0 X) V% F
9 J: v) u: j! Q5 j5 [ `function populate(){. B: \6 m' _: r' j0 g6 D7 ^
if (iedom){+ P: Q* b& U& D' v+ i- N: M5 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 L q5 u- z S( x/ y) O
cross_marquee.style.left=marqueewidth+8; ]$ D- g8 r6 G' U3 I8 g
cross_marquee.innerHTML=marqueecontent5 T2 N; |- v' ]# X* f+ {' X- ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' T; A U5 g s2 b
}
, ]6 {+ v) `/ ^6 z/ welse if (document.layers){# w; E2 F$ \, [1 A7 w i
ns_marquee=document.ns_marquee.document.ns_marquee2
1 V) I5 K3 w3 }, k# \! ]( e" Gns_marquee.left=marqueewidth+8
2 E0 g: ?- u9 Mns_marquee.document.write(marqueecontent). k! w+ N; V% G0 V; a" ` O& ~
ns_marquee.document.close() `' I7 e/ }/ ~) p9 i j! b
actualwidth=ns_marquee.document.width" r& k) {+ E: N
}( d: g4 w2 a6 v* X" z2 @5 e- t
lefttime=setInterval("scrollmarquee()",20)
& r: w) n9 [- \6 A}9 e- R1 R1 A+ E9 k/ c4 A
window.onload=populate
' b j) c# t0 Q; w4 \- [: B3 X: p
( a5 U2 O+ I+ y. G6 \function scrollmarquee(){
9 w- k, R b4 U3 G: wif (iedom){0 q9 Q5 x/ ~5 i5 Y% X; K7 U9 s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 E0 k0 y4 ], l) f8 i9 f" Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 ]8 M1 Y, u$ w2 T& b( @
else4 l9 A- @: \# x, T$ V* D
cross_marquee.style.left=marqueewidth+8' I7 X1 z, ]5 c% |9 ^' q
0 T7 @- p. c; R" y" @}
) G8 i8 R& g! f1 U$ Ielse if (document.layers){$ c: U+ l- B1 u$ C2 ]9 `
if (ns_marquee.left>(actualwidth*(-1)+8)). l4 F6 M! ?8 e$ n) b8 J
ns_marquee.left-=copyspeed6 S, E1 N. a9 ?5 W+ u# K
else( H7 t! {# H' W) z
ns_marquee.left=marqueewidth+8
% j! [- ?6 G$ N6 x4 ]' S _}* a4 O- x% Y: `& J4 H
}( [% L6 q" q* W) t; a: D* y; b: R
7 m& V- Q( f' H; R
if (iedom||document.layers){2 z1 e) d$ d& h% w! ~
with (document){
0 F& Q' n. g" M8 }6 j H3 X8 H* ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. f. F& I$ ]5 q7 c% r' X% j& Rif (iedom){7 F6 c' D+ O9 h3 o$ `2 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 n1 h* g/ K1 G3 Y/ x! x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# x7 V: z* B6 [, u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 s v7 i( ]( d0 |7 {; {7 o# Owrite('</div>')
* p7 c+ i8 u7 G* z, @}" O/ Y4 \. M8 a
else if (document.layers){
: X5 i& O3 t1 |* ?0 {! \' W5 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" ?! u. T/ g Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); o/ P3 ?% K7 j
write('</ilayer>')! a- m4 b* s3 S( ~% S* c
}
! \' F* Q" c6 Sdocument.write('</td></table>')4 q% P2 A, z0 p
}
7 }& E' ~6 F: R/ V. [5 H}6 H2 h* O# U9 I
</script> |
|