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

|
网页之跑马灯文字特效
//修改宽度
9 a2 R2 P4 v7 J v) u2 Qvar marqueewidth=300+ |3 C3 w7 A% l; B) b5 _( ?
//高度
* |/ X' O; ~! q. U0 Jvar marqueeheight=25$ x; G3 b5 x z. e1 H+ `
//速度(1-10)7 Z! G7 |( u* p: L1 k
var marqueespeed=32 V/ ^! x3 N" t) `& E) {
//背景颜色
' j1 y# f1 J& [var marqueebgcolor="#FFFFFF"1 d* l/ F+ J) u* ~
//是否能暂停 (0=no. 1=yes)?
0 x ^* ?% p. Q; Rvar pauseit=1* P- `9 F/ Z" p+ d
1 O" d/ Q+ D+ a; e1 I7 }" n//修改显示内容3 d0 F2 y; i0 n7 b6 y: k1 F8 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! _7 ^1 |+ c, F9 ~" k* `/ k' w, P
7 T4 i5 Q! q( Q
: N) e: |0 h3 T, ~: i////下面不需改变////////////3 A$ L* k4 j& w2 r+ x
- a& @/ M- C0 B9 u! b$ Y3 u0 T
var copyspeed=marqueespeed
: I/ w! g$ n gvar pausespeed=(pauseit==0)? copyspeed: 0
$ e0 S1 X( L9 E1 J/ `var iedom=document.all||document.getElementById
* l' l1 q$ L9 B. pif (iedom)
" H( t( X2 J- Z0 j3 [% U# r. Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 v* X2 J$ a7 ^9 v8 Y2 H3 R! Q# I* }var actualwidth=''
- u' P4 S0 w% t+ e8 avar cross_marquee, ns_marquee4 |. z2 F+ p8 ?, E" ~0 t7 |/ W7 t
. _1 P0 K' a1 \' Afunction populate(){
/ Q& R% J0 |9 V( {+ O6 X; Fif (iedom){
" M5 h/ Q; P! L0 ^/ i' V6 o: J4 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& {+ W! E: j5 Q( Across_marquee.style.left=marqueewidth+8' `+ w+ J5 Q2 ?# m9 W) k
cross_marquee.innerHTML=marqueecontent5 K& X% ~. [* y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; W* j0 o# G Q}; k3 Z1 o; v1 O+ \$ G
else if (document.layers){3 W; `% R# n# H" Y- i4 _
ns_marquee=document.ns_marquee.document.ns_marquee2# h8 L7 y+ D( S5 s" ]5 }% W
ns_marquee.left=marqueewidth+83 \) R+ c* a& V
ns_marquee.document.write(marqueecontent)' ]; F' y- P; A, e) T- u$ t& b
ns_marquee.document.close()
- T/ p( [+ o% ~actualwidth=ns_marquee.document.width8 v w' w: z; ]
}/ [/ U2 K; }9 N
lefttime=setInterval("scrollmarquee()",20)& Q+ [; K2 H4 l g/ [9 `1 a, k
}
. z" Q2 I; F, qwindow.onload=populate, x. @1 {$ h5 Y1 U
. H2 O' [' i; p7 i. i _5 Q1 P6 u
function scrollmarquee(){2 x7 m, S0 b7 ~8 `1 |# o' X7 M
if (iedom){# R- `7 u! \- Z- V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): L1 f1 @- J& x. s' z* s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# _( t, v; s1 f uelse
' Y) g c7 j. K( t& Bcross_marquee.style.left=marqueewidth+87 Q! ~5 k% H B( n
7 M# a5 ]; s+ t8 e0 A, {( u
}9 w2 p' h" s- F( d5 K
else if (document.layers){# E4 O4 `2 x+ ?2 ~9 Y
if (ns_marquee.left>(actualwidth*(-1)+8))% J/ i1 w% e1 W0 v5 T! I
ns_marquee.left-=copyspeed
( C: a. Q# ^3 H4 A7 Yelse! \$ j% _' D: {4 z
ns_marquee.left=marqueewidth+80 N7 Z8 q, G8 g- h8 Q: ^+ Z
}
7 [6 e8 x( C% `4 w}% K% m) d* N" ]6 B
9 `* k, s" Q4 E r5 X( e5 J' vif (iedom||document.layers){
0 W; ^6 |6 D7 {1 W) `with (document){+ U% Q8 K/ q/ i Y8 _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% ^$ _/ D$ m; t5 J( p* b, {. zif (iedom){
2 h: ^2 o6 Q' n. ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); ?% F% e G( T; K, ^7 I4 d1 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
]. L: j+ ]. |$ s( Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% i& j. U" w1 x8 u
write('</div>')" |5 Q/ Z- d' y
}9 ?! f! H# ~) M& @- g
else if (document.layers){
# k/ n5 k( S( jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 C0 [' g; f! ~, S0 J( A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 g; D3 }; Z' c- u2 E
write('</ilayer>')
! W2 J2 v3 P3 ^ F J' ?$ L0 V}
/ x' H6 n+ y g5 p. ]0 M/ Zdocument.write('</td></table>')6 M3 F( n" ^/ B( R% p# f
}
. k- W( h9 m. f$ P# B% M6 k- n}4 E4 V2 X# W! @7 W3 M1 [
</script> |
|