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

|
网页之跑马灯文字特效
//修改宽度% {: C4 W. @8 g' g
var marqueewidth=300
- u+ i+ o5 ^. r//高度
4 A1 d2 ?! m! _3 H' u- I5 Tvar marqueeheight=25
( `5 Q! c- f% O. h$ }7 e0 v+ G( a//速度(1-10)
7 P* e1 d; s$ e9 Y4 jvar marqueespeed=3- O. s$ |1 g+ e* [$ G
//背景颜色
* l- K7 q( M C' j3 Cvar marqueebgcolor="#FFFFFF"
/ @6 m9 \4 X( q) l3 I& D U4 U8 e& U//是否能暂停 (0=no. 1=yes)?
6 H& B$ x: Q" q8 j& E! E4 Z; e2 W( ~5 lvar pauseit=1
, d6 l, j7 ?2 r% c: I4 F$ X0 q0 {( @2 W
//修改显示内容5 S) W! n( v. R/ j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. D: i5 ]! ~6 I- _
7 ^" E! z# j) l$ q# L: p
m0 ^6 E/ f+ s( L ~ K: u////下面不需改变////////////
& x- x. O4 i3 g. `* I
* G- h, A, u) Z9 c. s v6 ^var copyspeed=marqueespeed
: ]+ L7 x& ]5 L0 h1 p( M8 O8 ?var pausespeed=(pauseit==0)? copyspeed: 0
% }% c! L% s8 tvar iedom=document.all||document.getElementById
9 q* J% i- f Q% b ?if (iedom)
; V+ L. [0 z4 H/ ?! W+ q6 ?) M% hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 \; u( J* ^' ?) C
var actualwidth='') P* V9 v& r# [1 g# a
var cross_marquee, ns_marquee
1 Q' Q9 O0 Q7 }1 g# V$ {9 |
" `+ o% j- C' g) Z* k8 V. O) H Ofunction populate(){* P9 t# m" E9 `( s, ^
if (iedom){0 w7 g6 |3 o. n$ h0 \, F X j, Z/ ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 o& x- U- c3 E$ Q8 [, Gcross_marquee.style.left=marqueewidth+8
1 e) e3 o0 r$ f2 ccross_marquee.innerHTML=marqueecontent
* t; U+ f- R( ~% C4 Z' iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' p* n. Z0 Y m7 h1 G" S7 e
}8 {5 c t' M6 C' \
else if (document.layers){! _7 u7 Q" G4 ]/ I. F
ns_marquee=document.ns_marquee.document.ns_marquee2/ j$ Z9 u% V, D# S) l. u
ns_marquee.left=marqueewidth+8 @% N: U, R$ M
ns_marquee.document.write(marqueecontent)
* {' C2 B4 O: L0 uns_marquee.document.close()/ r; @, U2 G, `! Q* @; M5 Q
actualwidth=ns_marquee.document.width$ H" H1 X# D" V, |
}
. J, a9 j8 s" A9 G/ a) dlefttime=setInterval("scrollmarquee()",20)0 b4 ^: T; h. l( l9 G5 p7 n
}+ R$ [. @( v- H& b1 E' F
window.onload=populate
. c2 \7 C0 j) ~0 d9 Z% T0 r6 G. b
! l" B) n$ ?- m0 D ?5 Ufunction scrollmarquee(){
% i8 \& s. M( w5 z/ H4 bif (iedom){
) d$ G: q5 m6 ^- oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): B4 ]/ f& o, f$ [6 k9 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* X' s6 V F6 ^1 R# belse
9 d- o) x/ C& ~- `cross_marquee.style.left=marqueewidth+8& v3 p' {6 P! U! q
% o4 Z6 v% l3 K: ^: A}" H3 a$ N# n( K2 V
else if (document.layers){9 |2 @ Q$ j% }, N
if (ns_marquee.left>(actualwidth*(-1)+8))0 L5 Q6 j) Q8 r/ m$ v: J5 p0 z
ns_marquee.left-=copyspeed" g$ p, W! G; l& M- m1 h7 o+ ^
else8 d8 i. r: Z i2 r3 U
ns_marquee.left=marqueewidth+8
T6 K3 d; N7 }% Q# A}( {' y8 E0 K$ d
}5 F5 o, ~2 u- a8 x/ j0 L
! e! N1 E% N$ T5 M" dif (iedom||document.layers){6 v% ?- _$ X0 Q$ M( @4 m( N: N+ I
with (document){
5 l" d0 t. I( B0 h5 c7 p8 h& L! X/ A& Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 r: m4 S+ o& }4 \: S d! d7 nif (iedom){6 B4 L' Z; U) q. d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' \* F# ~7 m6 P x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! C+ z4 ]; y- q& ?% H$ I. p+ M( p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
G* G/ m& `" [( }write('</div>')
, ?% y" V( T$ R, d3 Y% m}
# Q/ B: A* X0 f; q; aelse if (document.layers){
; ?, g- K: L. D) Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), b( ?9 a) [' @% G/ p2 d5 B& f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 X, J' F9 t& b8 h9 P) ] xwrite('</ilayer>')
" Y5 u$ ]% E2 T3 `5 j( d: P3 a1 G}
# ?- J9 J0 ^6 ~+ ?2 p' P0 Kdocument.write('</td></table>')
( o7 D7 p, b! a4 ~; I Y% X}
" T- g( u) p4 a7 p6 n6 M) @; Q}; Q; f W4 w7 s" p
</script> |
|