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

|
网页之跑马灯文字特效
//修改宽度9 X8 b! S1 {, @9 V/ O
var marqueewidth=300
/ Z$ {8 M+ B9 O5 ]3 p//高度
1 X6 U% H6 J2 L5 ]/ m/ H4 _* ovar marqueeheight=25
0 B* d+ r# O( x- Z* I0 v( c//速度(1-10)% ~9 u# G, o) x6 m
var marqueespeed=3
6 _. a; R2 V( J//背景颜色
! ^0 ~" w$ _% _' n6 gvar marqueebgcolor="#FFFFFF"! A; C+ _" H8 P- D, O# F/ L% n
//是否能暂停 (0=no. 1=yes)?
1 _( y: t+ \7 @" E2 G3 `$ jvar pauseit=16 c2 \! a# B; p: s0 [% ?0 t
" m- N" G' t2 f/ L. n
//修改显示内容
# E+ n- G- H3 Y; v6 k- zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ b5 s! j q: V% F' Z3 e
. |& Y( D# T* X5 b( e2 U; T+ G J6 E9 q, I0 [$ V
////下面不需改变////////////
8 W; ?- V6 C; J4 O
0 O) c) J' R- d- uvar copyspeed=marqueespeed- F7 F2 n0 s, ?! ~ n1 j {9 N
var pausespeed=(pauseit==0)? copyspeed: 0
6 K1 G" o" K' }# i9 m2 kvar iedom=document.all||document.getElementById
" e, r9 L# u2 C0 h9 Y+ g! {if (iedom); z$ Z; {7 g' E+ q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); r1 A, b: J3 I2 P: i
var actualwidth=''5 U/ k% f' ~6 j# v; J
var cross_marquee, ns_marquee
/ _7 K E- n3 e" _# p$ o% o; S, a: e: a
function populate(){8 w# J: y/ M' e7 j$ E
if (iedom){
0 D+ ] Q0 r0 \1 v5 q) r+ K0 Q: Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 [- @0 o; V) dcross_marquee.style.left=marqueewidth+8
0 ], z) g/ o2 x+ p( }cross_marquee.innerHTML=marqueecontent* s. y! n1 q8 @6 M& i4 X9 J% g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, j" y! l6 c* y# Q6 g& x}
$ k [6 h& c$ O0 v7 Q. \0 Nelse if (document.layers){
2 Z: j5 |( ]/ O, v9 `ns_marquee=document.ns_marquee.document.ns_marquee2+ C9 E% O/ `! T e% Z: H3 M
ns_marquee.left=marqueewidth+8. ]! R: q$ y; t! U" h
ns_marquee.document.write(marqueecontent)# B9 F- Z* Q6 z
ns_marquee.document.close()) d3 K4 a$ S! t `3 g. _9 Z* S
actualwidth=ns_marquee.document.width& E2 d6 ?+ D- J3 U, t4 a
}4 C5 a0 H }! K+ L
lefttime=setInterval("scrollmarquee()",20)
; e2 C; I' _& ~% f# R; B/ U3 e}' a5 s8 c' a! j; w
window.onload=populate7 c( a; |, u$ ^8 y/ X) E# o
1 v3 X% ~0 v! |/ e$ v0 K4 L7 `$ tfunction scrollmarquee(){8 c+ f9 a2 w; E$ a: i
if (iedom){
& o1 M# B* l7 M# y) xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 y, M! w& _5 c7 k8 y$ Q$ H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: ~2 K# `/ L0 g! J+ ?5 |0 Telse
" q: ]" T( n- V9 F0 z, |cross_marquee.style.left=marqueewidth+8
+ Y3 {9 X* s. r1 a' C+ Y; ^5 @; m1 z! ~- e7 q( B% p1 s5 `* Q
}
' F: q4 V u+ q1 }: k% ]else if (document.layers){
0 ]3 R1 V D3 t% @8 I6 j& E9 yif (ns_marquee.left>(actualwidth*(-1)+8))
, p/ ^) Q8 E: s! b$ A1 }7 Zns_marquee.left-=copyspeed
9 E, r+ T- A ] W x! y: Melse9 J; l; L# H* k3 ]' r' A! w- K
ns_marquee.left=marqueewidth+8
" U6 p& M6 }2 X3 {" C: H4 A7 i}/ @8 o+ `' U2 y9 ]6 e* g3 ~
}
& \% h/ t8 ?5 f! E u, D' N
* q+ s: h/ O& y+ h9 Aif (iedom||document.layers){
6 @% _. ~6 i- h- Twith (document){- e/ {7 I/ ]. {6 c4 L0 \1 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), |5 T e) g( t) P
if (iedom){. y* X, ^/ k x5 T0 H% W. X& v. l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: } N$ P" T- {! u. g; T, rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! L# o" ]4 }6 W; }. m0 F9 C4 Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& v2 u0 ^) b* B( X6 S+ ^
write('</div>')
& r7 Z( z( S: h+ z2 ]}1 Y: l) L8 ?6 a# |
else if (document.layers){
& E G2 R4 _" z# l2 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- S, G+ r- Y& \6 B4 `) Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). @$ I- H% s5 i L7 G
write('</ilayer>')4 e( q8 G0 f; a! l: M
}3 x3 C9 h7 b {" V9 u0 P
document.write('</td></table>')
( Z! g6 D' y( N- e( r( {}* c3 a7 }+ z5 p0 C) f
}
* a+ t; [! l5 t# x) B$ X</script> |
|