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

|
网页之跑马灯文字特效
//修改宽度6 F! ]2 ]% @, o% \
var marqueewidth=300
$ C- G9 ~( r& r- _//高度; C4 _* W' Q8 m% @& W$ G) ^
var marqueeheight=25. ~: y) S( }5 x3 Y4 h
//速度(1-10)* H- f5 r8 r) D4 L% \
var marqueespeed=3, \( @6 G7 f% s) F- Y- Q
//背景颜色8 ]6 v! W& Y y: a3 X
var marqueebgcolor="#FFFFFF"
, y1 J4 W; l; g6 [( U: {//是否能暂停 (0=no. 1=yes)?
h* \9 f" v9 X. O7 xvar pauseit=1
* B9 J0 j# L2 s+ I0 `3 s0 b- y
2 I$ `5 O/ W, x' p/ j//修改显示内容) U) e! N& R- {6 i/ V* }( M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- ^& g6 e; l: M; C: h. M
; j/ `- [2 _6 a! [+ R0 |
( S8 V, a' ]3 p* j: `, K) I////下面不需改变////////////
( H$ \. D, E+ g: B6 w' O3 f4 ^/ Y# x* f, U$ S
var copyspeed=marqueespeed+ c% @5 h7 ~. j7 j" @
var pausespeed=(pauseit==0)? copyspeed: 0
5 F8 h- \8 d! k: i+ xvar iedom=document.all||document.getElementById# y- @9 `& [% N- r
if (iedom). G! ^3 C! ^* f* [: C0 I( T3 i1 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# H$ z" t$ z7 j1 i4 C$ vvar actualwidth=''3 N* x. n# q) o5 Q$ T
var cross_marquee, ns_marquee1 u( F- A/ |) G$ d
& U( }% i7 T1 E! S! U; Vfunction populate(){4 p0 N; [- w# L2 G' F4 ^0 }: A: M. U
if (iedom){
) W8 ^' }! G8 C! U* t/ ]; kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ j: X! d P4 f. @cross_marquee.style.left=marqueewidth+8 W& R( d: H( F c) u
cross_marquee.innerHTML=marqueecontent0 F8 f" N8 A$ h4 {# Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ F: n& s9 d2 }8 l& f; _}
8 \1 w5 a( o& J8 B7 R, Yelse if (document.layers){
' p( f" N0 Q, a, O( U$ C( a: r* _1 _ns_marquee=document.ns_marquee.document.ns_marquee2! F! j9 a0 n: j
ns_marquee.left=marqueewidth+8* a. X4 b( s2 H8 ?1 u' X. l
ns_marquee.document.write(marqueecontent)
) `7 z5 Y5 t# V, h2 e- t. zns_marquee.document.close()
S$ N6 {! }! E. Vactualwidth=ns_marquee.document.width
: O8 x2 f% ^: y1 v}
( L3 |: T- k8 f( r7 q- {8 Hlefttime=setInterval("scrollmarquee()",20)
0 F& t' M: F: F4 `}
+ Z' q+ s) x7 h6 ^; ~window.onload=populate2 a' Y/ O4 B( S# J+ S" i" w
8 K b& e8 W d3 K3 W0 z2 b* \function scrollmarquee(){% } n# X9 x) y0 i9 P' @
if (iedom){
; N; g, L( z5 P; O9 @* ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 V* k# ~4 z$ q( f4 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
T6 E) k" V8 h ^& [8 w4 gelse; a" x' k& E5 W% l8 m2 C
cross_marquee.style.left=marqueewidth+8! V$ A% {" U% [% u; V. M
# x' K8 h% E1 v, _2 U}
% N! a3 v1 \6 C; Aelse if (document.layers){
: i2 q& C) {% b; iif (ns_marquee.left>(actualwidth*(-1)+8))7 J- o0 O& T. W- [" y
ns_marquee.left-=copyspeed
1 A: J$ J# K) `" D9 M4 P) _else3 r/ S7 M. h7 T( u y
ns_marquee.left=marqueewidth+8
& i' M* n9 B, U}
* G( |6 W* s) C1 H}. x+ I2 ?4 }* r. S
3 n! m- n3 G8 n2 a0 Z9 d) g% Rif (iedom||document.layers){, }$ k0 N5 T3 ~9 |, M. o5 `
with (document){
1 \7 }) {9 x" y1 B9 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 j' U2 s9 d5 zif (iedom){
+ {7 E5 ^1 X; n, _! Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- `: B0 G% X' U+ q& c0 {! awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* k0 N, J9 s" \2 \0 Q& Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') L# Z9 U; G/ T5 Q) V
write('</div>')0 U' }* o8 E& Z. H# P
}1 U& T# k4 h! v4 ^+ }
else if (document.layers){
2 h' W' T$ X- a; [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ e. k$ R% @4 s1 r/ T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ M) f# s7 X" s) S" P$ jwrite('</ilayer>')+ h& }0 C$ H, T8 M
}
# N" i: ~0 t$ n: y4 B6 h7 Cdocument.write('</td></table>')
R4 A+ R1 R# O4 C( K}
5 P7 v; B* F8 m0 v+ \9 j- D* V/ Y}
, M: |" s6 N5 |- z# U* H# }</script> |
|