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

|
网页之跑马灯文字特效
//修改宽度
+ g& L2 u% V8 T* } Zvar marqueewidth=300+ } L1 @& ~+ {3 L: P& F, L
//高度 `. D( [0 G" t( g" b# Y
var marqueeheight=25
1 \. M% i1 y5 Z' k+ M1 A2 }//速度(1-10)
: @ a: Y, g( h2 I4 A6 Ovar marqueespeed=3
+ |0 Q1 U) k# J& |//背景颜色
$ Q0 z" d& H+ @5 N6 X7 Svar marqueebgcolor="#FFFFFF"3 p1 J/ ?/ s# G
//是否能暂停 (0=no. 1=yes)?0 W! \9 V& r2 m( @& X: O* A
var pauseit=1/ S6 I! p8 F; W1 x# p' {: G
* A4 u I/ o. R3 K1 y. K
//修改显示内容
5 O1 J* }, a3 Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" t6 E$ O0 _9 N! a3 y
1 M* ]8 u K9 S+ j$ N# o
/ X& v7 n) V8 N+ L# I4 U2 B1 g
////下面不需改变////////////( [5 ^4 @; S$ T- \( [5 H6 O6 @* M5 G; A
5 O5 T! F; u9 n- G0 }9 ]% m
var copyspeed=marqueespeed
5 q& p2 _' A% a7 @$ f, u7 Wvar pausespeed=(pauseit==0)? copyspeed: 0- z) |. N* _6 k3 }% q0 H# k, H
var iedom=document.all||document.getElementById
$ h3 ^ }- g5 B2 T2 Q+ qif (iedom)
& t0 K' c/ F, H+ ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 h/ S& ^8 h8 Q2 ^' n
var actualwidth=''2 r" T2 a8 K: }2 G% I/ l$ ~
var cross_marquee, ns_marquee
' H8 x- C; D4 n/ n4 a! M# U+ w, A- T2 V
function populate(){
% _/ K+ \; r: I' K. hif (iedom){
# [, s! G% m' Y1 ]! ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: z% D' n# k$ p9 S; N, K& `; c9 Icross_marquee.style.left=marqueewidth+83 i/ y8 k- q% a% h @4 y
cross_marquee.innerHTML=marqueecontent
: N% T7 ?% d+ k0 }1 O5 wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' Z1 C) k3 ~1 o- j: ]
}- k! o) o: H2 O' ^
else if (document.layers){
( ^! O" Y- {( p5 fns_marquee=document.ns_marquee.document.ns_marquee24 H6 \: G! A* B& R9 M" u
ns_marquee.left=marqueewidth+8
: a" P) L- D! K/ M2 pns_marquee.document.write(marqueecontent)/ B( J0 ?# c" D* F1 r
ns_marquee.document.close() ?. z. t! U0 e% e: t$ z, \! v% ^
actualwidth=ns_marquee.document.width2 o( @! y' G _3 t8 W y% M. ^
}
3 U% u& U" \4 S* olefttime=setInterval("scrollmarquee()",20); |' A4 [. u) p8 ^. m6 F
}0 g: z1 }( C, u% b# p
window.onload=populate$ g2 J3 ?( C* n+ [: Z P$ r
0 _, S. m& K' v4 jfunction scrollmarquee(){
0 L6 A0 p. S2 J0 M2 q4 Z; e8 j0 Wif (iedom){
5 j; V% ~# I' ]6 ^0 R, Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 U# C1 y$ }% Z; `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( v t) }" V& p: }- z
else
" y$ }5 B; U. d% H* v% Scross_marquee.style.left=marqueewidth+84 K+ N1 {& |: m+ ?- q5 s6 b
+ i. ]1 J3 ]& W3 W}
! C; ^5 Q0 D3 \! O: r0 ?else if (document.layers){6 |. D3 [- S, L, t9 m' ^/ l
if (ns_marquee.left>(actualwidth*(-1)+8))% Q. f) X8 D J4 w3 o
ns_marquee.left-=copyspeed
! x! ^+ N- H* F% o. l, _) f0 jelse+ V, k3 v- p! }2 B T+ G2 a
ns_marquee.left=marqueewidth+83 N. s0 o; E! u: Q" ]
}/ V, R8 g. M% C) N( }# N' Q
}
6 E6 p2 j0 Q* S( }; F9 I- d
! a' i( w1 L5 J9 }2 ^6 Oif (iedom||document.layers){& n( G- U, I5 f# m. k! @
with (document){
4 [) y6 e. B9 {; h6 j1 Z9 kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 v! [# `3 `, V6 `# y" m; vif (iedom){
9 N- C4 ?1 {) x: ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). b0 _, M3 Y0 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; R. c9 ?5 C3 j# n( Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
l8 Q" c/ B5 j5 Y0 d- B3 {8 Ewrite('</div>')
* Z: o2 n6 U" W& ~3 U5 \' }}
$ n# k, h* [' h1 Ielse if (document.layers){
, o7 {1 G6 }3 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 k6 }6 a) E0 x2 p# v+ k! \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, @* n2 g* {! [* T3 owrite('</ilayer>'), y8 p6 ?0 L; u' y
}
/ p: }1 }7 z' }document.write('</td></table>')
3 S8 z1 _4 T' z5 w9 V( {' _2 R}$ f5 @) j u- f/ Y! F# L/ e
}
7 n) B) X$ q1 B5 u, E0 E2 Z</script> |
|