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

|
网页之跑马灯文字特效
//修改宽度3 v8 W0 D* I" b' w# }- n" U8 w
var marqueewidth=300
& v0 t4 \: A& x3 t, S5 q//高度& ~. a3 E& M% ]9 Q) I# w1 i: v; X5 A
var marqueeheight=25
, a+ V) f% |6 ?2 L' c6 o* P6 x//速度(1-10)! K) |9 S4 `5 |* f, I
var marqueespeed=39 ?( ^. b: V" F' W. ^ i7 Y
//背景颜色: w, Q7 L2 X) y
var marqueebgcolor="#FFFFFF"! A N) ]9 D$ X& S+ h% l
//是否能暂停 (0=no. 1=yes)?! C: L8 `/ J2 W8 w/ ^# m! }
var pauseit=1- W' L. m; `- l4 h" m
2 A: v& b: U, a: c( v3 L! w
//修改显示内容! X, R. T" _( k6 l( ^2 \, C( \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' T3 f' o W! v0 |! t
6 f; V7 {: \$ J8 S I% K. j; q$ P9 d3 I% }
////下面不需改变////////////
, N) j0 v- c% _8 {* T: A L; u j& t% Q6 r3 K2 x+ T
var copyspeed=marqueespeed) a8 e4 k7 k: ]
var pausespeed=(pauseit==0)? copyspeed: 0
# ]2 V/ v5 x# S4 w1 F$ x4 L0 Yvar iedom=document.all||document.getElementById
f" D# t1 ~9 q3 fif (iedom)
( t( I' b% R4 [$ D. _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( f1 s @! f6 Tvar actualwidth=''- x/ S; j! e# ^1 i) @( M6 W
var cross_marquee, ns_marquee
# H) P& z! @( H* D) r, `
% G: b2 d8 {4 W/ \$ Kfunction populate(){
" K! K* a, ~( Z' v" l# Z6 ^% xif (iedom){% W) K. n7 ]6 Z/ X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 u) T, X: ^6 A; x$ tcross_marquee.style.left=marqueewidth+8. }. Q3 o, a( c; c, L. m" \8 d
cross_marquee.innerHTML=marqueecontent6 o- p$ ~! V; A: o- l4 W$ g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. W8 A* w: }3 k# B& o7 L7 E; x}6 Q6 R) ?' c, n- g$ s1 h2 Q. T
else if (document.layers){
4 E4 G7 A( v s3 x; U6 D ]ns_marquee=document.ns_marquee.document.ns_marquee2
6 ]( `( A6 j7 i8 ]. P" h8 }* P+ G' jns_marquee.left=marqueewidth+8) e% G- W* g7 D
ns_marquee.document.write(marqueecontent)
, P, e$ V+ e) Z Nns_marquee.document.close()8 m7 T/ I$ l2 l4 @, V# T! W
actualwidth=ns_marquee.document.width
+ U/ J) L8 m9 Q5 ?}
4 A4 F% [& X+ i0 o7 K. R% D* L0 Wlefttime=setInterval("scrollmarquee()",20)
4 O* e- h9 e" ]0 b$ a} t9 I# j# c. F9 x6 `
window.onload=populate
5 O% Q# {( [, D$ _9 d2 o4 p5 w; ^
' Y) T" V) a. E; ^' A8 B3 pfunction scrollmarquee(){
- j; g& Y7 r7 w& z* |% Rif (iedom){
* u0 T- N1 m+ C2 x7 ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 _8 H5 a1 W M8 F5 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed p2 e1 G9 B) |8 n2 L8 f
else
; c9 I u) `& q/ i3 E) ?cross_marquee.style.left=marqueewidth+8
% S, l0 x+ d- n6 H9 o2 X* }
) Z. s7 C. Y) T9 Y6 Z}
7 \; M- `* ~/ j8 velse if (document.layers){
& o5 u% |; H" A. i: iif (ns_marquee.left>(actualwidth*(-1)+8))" o. S7 u+ Q- `2 X" J! D
ns_marquee.left-=copyspeed
8 c2 Z# c7 m& S0 ~else
/ C4 m/ S4 }9 X# z8 E8 c) cns_marquee.left=marqueewidth+8
% _; ]+ E1 Y2 @5 J}0 y" [* K1 L W/ x- J7 N
}
v- p7 i/ F' }$ p! s" M
' [" p2 [0 p1 mif (iedom||document.layers){
& b5 b; @9 c& E* P5 dwith (document){
6 N( O7 c- L; d9 K& K6 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). v( U3 |, M4 W- L$ O& U
if (iedom){9 ], z' Q6 o3 W1 a# E* U7 S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
D( S) b$ b+ G+ e1 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- M, \% H7 y7 f" q$ l! B. ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( R% I, i3 g! C; t1 Xwrite('</div>')
4 A5 v2 a8 n$ m}( Q7 T7 V7 B7 ?4 Q8 L1 E
else if (document.layers){
# t8 k8 ? S+ {# E g( ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! Y6 L1 F* c( R! J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: {7 J9 L# ~4 v& ^# cwrite('</ilayer>')* M* Z5 _+ f5 T0 c4 O; O9 D, K2 B
}
/ y1 R7 y' R2 i/ g# mdocument.write('</td></table>')5 `- Y- p K8 o& P% K
}7 Q- g. ^1 ]% [( C
}$ {+ h$ v, O* F0 A( H
</script> |
|