返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 Q- U9 m  b1 J6 o. d0 |
var marqueewidth=300
* b  L( z  x( b; \& P4 v) [//高度
0 ?0 F) ^: f( \3 C& bvar marqueeheight=25: O( z; h+ X9 g4 ?
//速度(1-10)
" r$ Y5 N, X% @. G4 Q  I& ~# Xvar marqueespeed=39 J" l+ I  i0 n% B
//背景颜色
4 b- _) O" i5 u3 w/ {3 Yvar marqueebgcolor="#FFFFFF"
2 r. w, f1 X6 J. t! t8 L//是否能暂停 (0=no. 1=yes)?
6 u; x  }- T- m8 R9 dvar pauseit=1
. Y' X* W: {, ?- q& d% d; n& G/ |
+ `" B) f/ Z2 q//修改显示内容
% R, S4 e5 R: ]0 \, E' O8 \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' w( ^. L0 a+ X1 _  \2 w- v( j9 I/ ~: J

# }2 d; T( y, J0 q0 ]- U////下面不需改变////////////$ \9 u; J8 N: b# s/ n
2 ~2 ]# R2 S  ?* n" }/ Q
var copyspeed=marqueespeed
- t- i' Z7 P0 |  V( b! @var pausespeed=(pauseit==0)? copyspeed: 04 I, J5 h0 Z$ {& c2 Q. g
var iedom=document.all||document.getElementById7 w" ?! p. e% C9 E- }
if (iedom)
7 F4 t- ^: b& D( [$ Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 u3 I0 y& y+ s) j# w9 @: y$ Y" A
var actualwidth=''- {7 M2 a0 z9 r
var cross_marquee, ns_marquee
3 d' a& y4 T- F$ l4 `
- X! e! B) r, d& \0 L0 Ifunction populate(){, N+ T/ S- l% g
if (iedom){$ C* L$ c  I# X! a2 X. `/ b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ [. I! S% y6 [4 ycross_marquee.style.left=marqueewidth+8
, a+ Q, C% i& P4 H# Tcross_marquee.innerHTML=marqueecontent% D5 J4 g8 {* @$ _1 t3 V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( p# `# s. h9 S7 w6 H}% Z- R0 d1 {) S7 K+ o* P$ `
else if (document.layers){
* S8 ^! i  R; w! dns_marquee=document.ns_marquee.document.ns_marquee2% R& l: w1 p* [* N2 D1 |
ns_marquee.left=marqueewidth+84 b: Q1 E* `: S- r
ns_marquee.document.write(marqueecontent)
9 S; _% X. E  Z: W( i. h/ \3 rns_marquee.document.close()) f  y: T  P; t
actualwidth=ns_marquee.document.width3 i& f1 _; V( U1 E' m9 A. h
}
5 s/ s6 f, ~* H1 M$ Klefttime=setInterval("scrollmarquee()",20)7 |2 u* H# u  I9 C. E% v2 E) y3 u! W8 l
}
$ g( S/ p$ ?2 ~4 n4 n* C3 Wwindow.onload=populate5 X) p. v5 P% x. B6 g

( A! S& f1 q, w5 Dfunction scrollmarquee(){8 g/ V3 n$ j$ G
if (iedom){5 a) @8 G3 i3 \) {+ L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 m1 M' [2 K" d9 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 d& w( {  N6 P! k0 pelse
" y7 W4 a* q  s, kcross_marquee.style.left=marqueewidth+8
0 M$ @* g  M# W% P$ u* B/ k; O& O
+ V( }$ i- r3 g% _/ ^& f! e1 d0 q}
& i$ @" k3 J! H) k/ g# k& ~else if (document.layers){7 H; ^% f' X) }. l+ @& E+ x8 D
if (ns_marquee.left>(actualwidth*(-1)+8))% o+ y/ u9 y& G& X: ~+ D
ns_marquee.left-=copyspeed1 y) M! o' g- K6 P: g0 @5 f8 F
else! k+ s4 q1 ]$ R& W3 _& C% e! Y
ns_marquee.left=marqueewidth+8
0 s+ R' e1 J4 M# N5 B/ k& A  ]}- a  u) G& Z5 Q8 l; |- d
}. W5 R7 E5 _3 v) V& b
# w" Y" |7 u1 o& W2 g3 z
if (iedom||document.layers){4 {; j. D; R0 l
with (document){# D1 r" l+ o* Y# S3 n: K- t3 f' I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 ^8 F2 L5 Y( h: \; h& W- Iif (iedom){4 V: ]! k4 D# O3 z# m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% N* s% H9 Y! p8 k+ R1 X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): p( j; O4 i5 i' a3 D! n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 P+ N3 O: Z+ X" y9 V# x0 \write('</div>')
0 ^1 e1 {  n) e3 J9 z. _1 y}# Q" o2 ]9 @; j
else if (document.layers){
/ G. ~* |0 X  [5 O' Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( I7 C$ s& A' n6 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* C  a1 Y0 s% M9 L. N( u
write('</ilayer>')
. V5 u: s  L2 s5 J1 D}: m* K2 c+ U' I" U$ O
document.write('</td></table>')
% T8 ^2 z* w* C5 }' j}
( d  ?  c7 H2 _% L" R. n# A}
6 S6 ~3 s' Z" C2 ~+ _; D6 r& o</script>

返回列表
【捌玖网络】已经运行: