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

|
网页之跑马灯文字特效
//修改宽度
; |5 C1 i) E6 z8 J" a2 |( svar marqueewidth=300& \0 I9 F {3 o/ V# V
//高度
M% [9 b6 h2 z3 w' M: C# Ivar marqueeheight=25+ f" I) b- l0 m; b
//速度(1-10)
' u+ \$ O! i8 o# A- mvar marqueespeed=33 n, r6 h, l" x' O; F. F9 r+ l& Y
//背景颜色
1 c3 A$ {4 S9 f; [ n. Zvar marqueebgcolor="#FFFFFF"* Y& T J' v8 f$ ^, \
//是否能暂停 (0=no. 1=yes)?; }+ k( q6 {! w$ L0 M; z
var pauseit=1
# \4 D3 Y0 ?1 W2 l$ m! F. Q$ U5 ?4 t& y
//修改显示内容2 p. |+ @4 V. M1 { E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', E% c: n$ h( b2 o
1 b3 {7 e0 ?. H! _5 n) Q# |- m" P
0 l- H5 d" W: R7 _7 M: l6 {% R////下面不需改变////////////1 I% N7 E& C2 \7 ]$ l5 c
+ b4 W- C6 |5 s$ |
var copyspeed=marqueespeed
. }7 a5 A# m4 D+ ?- r* y8 T' G# Bvar pausespeed=(pauseit==0)? copyspeed: 0. l! n5 B7 l2 C1 d+ F; H
var iedom=document.all||document.getElementById
* {# ^; t% O; n4 xif (iedom)) g+ v# R- d7 F' L) ?& {/ w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* r: W* R* y; h2 a
var actualwidth=''- f o" a7 D) ^- S7 R
var cross_marquee, ns_marquee3 Z9 `3 u. ?3 H3 F+ M% j# E2 R' L* D
) {' N$ L7 I6 s1 r+ G% `
function populate(){* |% t4 O/ x( x2 ?1 O( g' h
if (iedom){1 S. ~: @' I. b% ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, [8 U7 B# V$ N2 Gcross_marquee.style.left=marqueewidth+86 h0 j7 W- W4 U3 u/ B* \
cross_marquee.innerHTML=marqueecontent8 t5 i- B" }2 h& f2 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
x! p; D7 _! }& G5 z}2 A* U! i4 d; z; j& \4 u
else if (document.layers){
~. p5 |; E8 h$ c3 }/ {1 l% W0 Nns_marquee=document.ns_marquee.document.ns_marquee2: B5 E9 \& m6 t- q4 ~9 T
ns_marquee.left=marqueewidth+8/ Y" ^ q& p1 G+ @4 o4 d4 w) U% c
ns_marquee.document.write(marqueecontent), D, q" [5 g" B+ N; O" k
ns_marquee.document.close()) r4 O* j. ~2 I: J
actualwidth=ns_marquee.document.width( Y6 z3 W H+ R) ^8 z9 h7 ^
}9 x, _# ^) K& @) S0 K8 ]
lefttime=setInterval("scrollmarquee()",20)
4 D, F6 [' a3 [+ X+ b}% `( N6 i. w6 X* u
window.onload=populate
' N: J6 e, W$ v6 f% [: N
! c. X, m/ c. J+ B5 s& h+ x) qfunction scrollmarquee(){4 n& _" e# ^7 ^+ ?
if (iedom){
; I6 I0 E: v& Y0 R/ R1 ?( G: Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 E6 x3 L/ s; w" i1 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 o4 ^3 E' _: h( Y r2 X1 e3 x
else
7 ?4 X* m" [) a- R6 L, D* rcross_marquee.style.left=marqueewidth+8
H8 h; _1 Z& x. w/ Y: {9 z+ P/ N6 }- @! r* H" W0 n
}; } V3 b+ H. p, q% `& ?- \* K3 ~
else if (document.layers){
$ h' e) }. C' c a& A. iif (ns_marquee.left>(actualwidth*(-1)+8))
6 ~; j* Y7 _$ P- Rns_marquee.left-=copyspeed
+ m2 e0 P5 k1 _# uelse
: ?) g& z7 s( W# Zns_marquee.left=marqueewidth+8
6 e6 |" c1 F$ ?! d. t1 w0 x! Z}) H9 i2 g& I" H
}
+ a& U% i, ]! T! [7 A0 X
) o0 Q! U1 S/ oif (iedom||document.layers){
6 J0 C! o2 T) c V" T9 ^with (document){+ W% a7 n/ W5 r# y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ h( e/ y9 H: g* B0 Q$ H
if (iedom){
/ G1 ~. s$ O, T k/ ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ s5 y3 A$ Z( X5 E4 s( ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" S2 y$ x( V" x0 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): t/ z# K+ C6 w8 x4 Q& b
write('</div>')
8 z" K1 h- z3 B7 t- H9 `1 t5 K, q}* i) D2 E6 c2 g9 R5 h
else if (document.layers){
- V; d1 o. b; C9 V qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); D+ s1 n* ?# I& `7 a% q& ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( ? m& V& M/ k2 s! e$ i9 Ywrite('</ilayer>')
% S$ m- w1 }# b+ {}
/ ~# ?* N) B' J# |2 hdocument.write('</td></table>')
+ L2 g! d7 V! G}1 `: n* P/ \) n2 t8 R/ o0 v! I f1 Y; }
}
* C) I" C H% W |1 ]6 u</script> |
|