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

|
网页之跑马灯文字特效
//修改宽度
. o) v9 R. Z. K! |var marqueewidth=300
) W* K( `: K) |; `2 ?9 F//高度
+ H1 F1 q. M/ ^" Mvar marqueeheight=25, }" v- y+ O: R" l1 w4 S
//速度(1-10)6 x& |8 ?4 S9 a z f5 k
var marqueespeed=3
: X S6 V0 ]% h% i: G6 d//背景颜色
% v# j, o/ P( m2 b/ J1 F0 S! qvar marqueebgcolor="#FFFFFF"4 _* j2 x( z2 v3 b% u) i
//是否能暂停 (0=no. 1=yes)?! o9 [0 t0 S4 s0 M3 m. V+ o5 I& X
var pauseit=1
1 N% \1 G1 t/ Y- n/ q/ ` F0 T7 E4 z" s% V" y
//修改显示内容
$ ~) i8 y. n+ B/ V7 H* g% }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ^, \; {- |' x8 p5 Q' E1 g z; Q
7 N$ F. }9 F d2 X" D" i8 h
! j$ `' T3 ]: ?/ ]
////下面不需改变////////////
$ q# G5 L9 W6 K$ t& L& w% P+ {
var copyspeed=marqueespeed
. F7 A. X' U- d# vvar pausespeed=(pauseit==0)? copyspeed: 0! m$ ~* N7 q9 X! l F9 {9 R5 o* k
var iedom=document.all||document.getElementById1 r) p$ e, r' X/ |# P* \5 a
if (iedom)$ g5 ?* x( O, P {' n4 r) Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 v, Y; S! M$ K' R9 {
var actualwidth=''
1 R6 C* \8 t2 }7 [! _& T( t9 Q; [var cross_marquee, ns_marquee8 [5 E/ F! h2 d' i
3 a6 X. T) F7 R8 U* ?4 D; efunction populate(){) h% w8 Z+ p$ S0 m4 K$ f
if (iedom){
. \) I$ b( c& S3 l+ l+ g0 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* G8 A4 R" V8 G6 z& P4 ]# [
cross_marquee.style.left=marqueewidth+8
8 V& Y/ P9 U, e& C' X% J! w9 Qcross_marquee.innerHTML=marqueecontent
/ _- `. Y' c8 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. f' o: a6 f( a- _/ k2 g2 k}5 |! c, X0 o* s5 {5 U
else if (document.layers){
+ v1 r: V- G5 f; kns_marquee=document.ns_marquee.document.ns_marquee2
$ e8 s2 C7 l& B* Bns_marquee.left=marqueewidth+85 c+ o6 ]/ r9 W2 V3 V0 Z
ns_marquee.document.write(marqueecontent)
. H6 J' G+ ?+ C9 a' s: S( ins_marquee.document.close()
3 T9 V* v4 f: K2 @' ~# Jactualwidth=ns_marquee.document.width4 w0 \7 o( b4 l
}
. T$ u& E% i5 |8 E; Y! f" clefttime=setInterval("scrollmarquee()",20)4 l+ j7 ^/ q& q$ [5 ]1 t4 Z K
}
: _! r, a6 u& qwindow.onload=populate$ X, h) R5 a2 h& {; Z2 ^
/ `8 s: Y: d. a4 _+ |1 p- Bfunction scrollmarquee(){0 \3 @. s' r& T& P* ]
if (iedom){
) M. k7 f; Q. Y1 kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 H8 A* [. Z- g0 r( M; l3 across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" V1 W% B# [' L$ O
else6 _4 J( O6 f4 U! u" q' }" D [ g6 x
cross_marquee.style.left=marqueewidth+8: h3 ~& ^- A7 U) q. y
4 G5 Z! v) S. U8 z2 P$ S
}
( ^% _7 } X3 \$ r* w( e* J" pelse if (document.layers){
3 c5 Y6 E2 m" z/ h7 n. Zif (ns_marquee.left>(actualwidth*(-1)+8))
' l, X6 X% D: Ins_marquee.left-=copyspeed# j& o+ v$ L% S4 o& H
else% G5 k& v( Q$ g: X- J
ns_marquee.left=marqueewidth+8
, r# v1 P5 {& L; P}
9 x" A1 i9 A r} {1 a" x" ^5 J7 I( a2 k( C' f
* o! L1 c: Q) C9 j7 T
if (iedom||document.layers){
5 k0 C# r3 ?& y4 ?. gwith (document){9 K" b3 `% Y2 W C; o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). S; R1 T' f O* b
if (iedom){
4 v5 c, u% m/ Q0 k9 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& J' G' Z* Q% m j3 Q7 z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 L( Q( b& y5 ^# b8 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' S' x! |4 v$ o, @write('</div>')
# |& F, |; Q* \8 m+ S}2 O2 v& T% o1 U" J8 V" \
else if (document.layers){
! g, m& k/ h/ b- D- Y) P" N G3 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* Y9 q& y) |4 n: i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' a+ p+ {& L/ d% o! V
write('</ilayer>')" E, W6 W. V5 H4 B$ w
}
9 x9 [* \& \6 ~' h4 A2 _ tdocument.write('</td></table>')4 W2 O+ j! ^# y% u0 n3 n
}- [$ N5 j5 L# O& [2 G: {: c
}+ O# w/ C+ r$ {+ Z3 f
</script> |
|