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

|
网页之跑马灯文字特效
//修改宽度
# ~; z+ P- X1 N$ E2 [var marqueewidth=300
; k$ E) Z6 L- u% n* ~//高度8 |. ?1 p1 {$ T% m: Q& W. V( W4 V$ L
var marqueeheight=25' Y) q3 `! U" i; s
//速度(1-10)
1 [* I. G9 w, P0 yvar marqueespeed=3
3 g/ O; m9 ~$ |( U//背景颜色5 B; b% i: s2 Q7 u" {
var marqueebgcolor="#FFFFFF"
$ e% V) w% ?( f. f//是否能暂停 (0=no. 1=yes)? @7 b7 U/ G8 K/ G
var pauseit=1
( P1 n% Y0 l8 K# } p6 m" |, J, u$ H6 f1 @9 }8 z# b
//修改显示内容
9 `4 Y+ s K# A- v' jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* q, [! t0 k& z5 T- }% K2 ?8 @
- @; C/ @5 ^1 y; |- A8 [$ I) j/ W& N4 V0 ?
////下面不需改变////////////+ k0 U) R% G5 g/ ^2 _6 s+ z; p
. d5 T: r; L8 ?& m$ X- gvar copyspeed=marqueespeed( @) e- V! W' W
var pausespeed=(pauseit==0)? copyspeed: 0
% v4 F- n p' {) C8 _% `9 Rvar iedom=document.all||document.getElementById
) t( i/ u( f8 e- uif (iedom). D O) h% w* @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 T8 X- l" Y" ~
var actualwidth=''
1 V0 |3 J5 \: q" [var cross_marquee, ns_marquee; t) R8 R" _+ t- k
5 D# m. }3 Z L! bfunction populate(){. d) b* |5 b$ v) o7 }
if (iedom){
: e$ ` z4 m: B! S( _" a) Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% x8 L7 \) p; O e$ f5 I0 W
cross_marquee.style.left=marqueewidth+86 }4 x# s% N8 C" w/ E7 w
cross_marquee.innerHTML=marqueecontent
~. T+ [; s7 |# ]5 y9 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* h! ?) J+ K/ O8 e: ~9 `}/ J, k g( R2 Q) w* i
else if (document.layers){4 `; Z; B1 I; a( A. |9 y, k
ns_marquee=document.ns_marquee.document.ns_marquee2. L) O1 a5 I7 J* p' F" ?
ns_marquee.left=marqueewidth+8' a( z! w" k' \6 K1 l
ns_marquee.document.write(marqueecontent)
: Y' u; ~, O: ans_marquee.document.close()
: T: G* C: x$ I$ M% aactualwidth=ns_marquee.document.width5 E# q( I! H6 O( W# A; |
}
- f, r3 G$ f' G5 U# Y9 Jlefttime=setInterval("scrollmarquee()",20)
$ T% L+ | {# G" `" z4 b6 `}6 b0 u2 [% N+ I1 ^
window.onload=populate
$ f" ~! T8 t! z* S* a
) g5 \- f: ?1 W% I% s" {: Q; Gfunction scrollmarquee(){
/ B9 p" R- V6 y/ I6 R$ fif (iedom){
0 A* x( t$ g. v! v; Q, _& g3 Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ i) J; A @5 p4 U, @+ v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) M" k, H$ o# f1 zelse
; e7 F1 P+ t+ T3 Y% [; wcross_marquee.style.left=marqueewidth+8# Q2 @ J7 _6 }5 V" `# I9 N- s- \
9 ?* }/ B; R( W+ t; m3 E8 `2 A}+ p3 j& p; N+ ]! U0 w
else if (document.layers){
' u, B. O7 O* L" l) H" aif (ns_marquee.left>(actualwidth*(-1)+8))/ C9 `/ x; K" `% O( ?# G$ ~! g
ns_marquee.left-=copyspeed
! D2 K0 r$ C7 u" {; eelse
s3 r7 S. ^, z. `ns_marquee.left=marqueewidth+89 F% W( K( X, ^
}
. Q3 n7 @# B* K2 j0 V# ~2 g}
8 A& p3 V M n! N% r
- ?" ]! ~- r* [" j1 v! L: Aif (iedom||document.layers){- {$ q( @2 \0 I8 @2 W4 e6 m$ m
with (document){$ _ ]& H# \2 k7 W4 ~% W* `2 g3 w. p. {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 n& z+ K8 P) H+ m, d
if (iedom){
" W: t1 Q& M' }; rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* k$ j0 G" N! [0 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 c- u5 i6 r( X# v4 u. E5 `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 |& k! j% C" Q/ I
write('</div>')& @$ a G ?# M. u$ L7 a/ b
}
# p* P: N( P4 G! L ~7 `6 ?else if (document.layers){
. P" Z! g4 K9 u; V5 F8 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 W/ I7 k. B" d+ U3 O3 \) Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* g5 j7 `' z- f" O& ~8 M/ [write('</ilayer>'); m% ?% @$ R$ z' a ?' e
}& Q1 z; f3 ~* F' Y7 ?( L1 R, j
document.write('</td></table>')
2 t' l+ g7 [+ \}/ D: w. I2 ]( }7 n4 y
}
; a% F2 X2 r" Y</script> |
|