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

|
网页之跑马灯文字特效
//修改宽度! f. M4 T: L' F: J$ c
var marqueewidth=300! I' ]9 q6 J) d+ `* Z" L) a$ t- h2 E
//高度
7 F v6 N0 J" \. I/ J ~var marqueeheight=25" [2 i" j; y8 s& y5 N. O( J+ W# F- T
//速度(1-10)
$ m% ^+ Q2 H4 W4 w5 {var marqueespeed=37 j7 t+ Z: p6 z6 J& w' ^, ]/ w
//背景颜色
* e7 v9 b5 m- h/ j1 evar marqueebgcolor="#FFFFFF") o4 |0 C; ]7 c
//是否能暂停 (0=no. 1=yes)?; A2 R& _6 `# l
var pauseit=1
4 `+ t1 w' _0 B. U( J* n: Y8 \3 a) V
. ], q6 k2 y+ n2 c7 D//修改显示内容( ~! S3 }6 ^5 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# r0 z9 E3 }4 P5 i3 `8 }" @0 K, D9 m N4 y4 a+ A$ F
: q+ V* h0 s( m; M: R
////下面不需改变////////////
( ]% l/ U/ ]: P$ Z0 D5 p2 O
) `1 T" q3 s- E; M5 W" j" ~2 Svar copyspeed=marqueespeed1 F( y( g1 I: ^
var pausespeed=(pauseit==0)? copyspeed: 0$ n& Q3 H/ i3 v }6 V
var iedom=document.all||document.getElementById
/ q1 o# I0 i, Y. ^, Pif (iedom)& Y5 x( G2 s: o$ U, \) w' _% l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( q2 E+ Q* Z7 a% K ~$ M Lvar actualwidth=''# z6 s) R, h a. C4 [
var cross_marquee, ns_marquee1 Z/ Y) X& |8 W4 u+ a
/ p0 F3 W7 i) V- l. g1 C
function populate(){
% S& E3 ^6 y7 ~8 H9 U; Aif (iedom){/ S- d6 J; k; G+ Q5 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 H: r8 t1 {: k' Ycross_marquee.style.left=marqueewidth+8" i4 T9 x" |1 u2 e* A$ @
cross_marquee.innerHTML=marqueecontent
T5 h& |. E4 O" k6 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 T9 _( ]% Z2 g: ]) \: l( |
}
5 o3 U* \" P0 k& ?! Welse if (document.layers){6 S: q) z: \) w h
ns_marquee=document.ns_marquee.document.ns_marquee2* ~/ I( i$ S% J# E3 H
ns_marquee.left=marqueewidth+85 e: p$ K* w- f# D, f. r R
ns_marquee.document.write(marqueecontent)9 x/ i4 u9 ?: ^/ S: b
ns_marquee.document.close()
! _0 @" [7 j% @7 m$ A% w% J- Hactualwidth=ns_marquee.document.width- M8 C) P/ E8 ^: f6 ^ E( K9 s
}. [& c* c& t$ n! E, C4 z& _
lefttime=setInterval("scrollmarquee()",20)
5 P& _7 B$ @# k$ f+ s}
4 V6 Y, @) u; J0 I3 h. N+ m4 \window.onload=populate S4 Q8 o+ o( I8 o
/ Z. S# s2 ]# B) d( xfunction scrollmarquee(){
, {# x* G1 ^. k2 ]; f% E0 rif (iedom){! o$ R! `. {) k+ X, f5 c! \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
\+ @( n; ^& H$ k6 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; b9 o7 m; g5 Nelse/ E/ L3 p8 U/ ]8 \
cross_marquee.style.left=marqueewidth+8
. Z( X+ S5 g! m5 q
* M6 n: H; O; A4 O8 z}. N8 s o- G- j5 Q( v
else if (document.layers){ r- N, X; }& m! M5 B2 Z1 H- \3 A, j# R
if (ns_marquee.left>(actualwidth*(-1)+8)), e3 h( E% v$ o! M
ns_marquee.left-=copyspeed
* G( [' T% ]* E$ t' K J$ ?" B# melse1 l$ m8 U0 W& d1 S
ns_marquee.left=marqueewidth+87 {: }9 f! C/ I' [! m. j9 E
} f) v% f* e- {
}
6 \' D7 L2 o6 m" C% W
% i; ~' p; H$ F: e& Zif (iedom||document.layers){5 H ?- Q" t. S/ r+ \2 D! \( i/ ?
with (document){
2 q# r5 U) _# m# Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); Z: O. Y9 w1 T0 a" ]
if (iedom){8 P$ O: C2 G0 V) K8 T8 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% i( o3 T. [% U8 O3 y8 L9 d0 {2 Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ o( X" [- {0 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( V6 e$ g' h& g. P+ H
write('</div>')
+ L* c# _$ k2 y- G% [}
7 d0 h) }: h6 ?) q6 Lelse if (document.layers){
, ~( D+ P0 F6 }/ Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' v- I# T! j Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% H" H0 E2 c5 s6 z% Swrite('</ilayer>')
& E5 f, q' {. |/ X3 J} w) p# z) R, X
document.write('</td></table>')
o% O) R' e& _# `$ m+ n! h}* b$ U, a% E1 F6 s4 b6 C6 N% c3 v: D
}$ W; ?7 \8 l6 }1 S3 r, n
</script> |
|