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

|
网页之跑马灯文字特效
//修改宽度: b, z4 W- w: K8 ^* D
var marqueewidth=300- o+ Y9 c& R' Y; P, \
//高度* r3 x$ p# E, |2 w& H2 e' q4 ]% ]
var marqueeheight=254 [5 ]" T. k4 `: v' ]$ n: h
//速度(1-10)* H; ~8 ^* A, {6 R: C. u
var marqueespeed=3& ^6 S4 I) c8 Y) _) q- a7 G) |
//背景颜色+ l b; F( T* ?9 K, }) q8 ]* U
var marqueebgcolor="#FFFFFF"
* Y0 M# l, T1 Y5 h$ c//是否能暂停 (0=no. 1=yes)?6 O, V2 Z& m8 S. A5 b% q2 x$ f
var pauseit=1- O! _; V! v$ J3 N
) P, G* ?/ P% T. x( B! s& I- ?
//修改显示内容
% V9 l9 g& r% U' L) A+ zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! P" q2 T7 @2 K1 {$ ?: ~: y# z1 _! `$ E. H
! B& f/ o- Z! w- X/ T////下面不需改变////////////
: R1 j' [; p) s" C7 }5 z# ?; @) n
" y' \. ]* x$ ~9 e: n! jvar copyspeed=marqueespeed
4 K! a' t* H3 `4 V' svar pausespeed=(pauseit==0)? copyspeed: 0
4 V. C( T) s2 Zvar iedom=document.all||document.getElementById+ U# A9 G9 B" ~- A! t
if (iedom)
" O! X; L$ |. q! \' ^. d; P3 A4 \: Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: R: U' E9 g8 X. D6 `) Yvar actualwidth=''
7 d6 C' L4 g, Ovar cross_marquee, ns_marquee
; \! n6 e+ B' {
. ^4 u% M$ C8 _0 f1 y2 Ufunction populate(){! T& y4 B# B' t( L
if (iedom){5 l$ `$ i4 E% c6 b8 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' ]* h' M; r1 U0 T
cross_marquee.style.left=marqueewidth+8
2 M s8 ], L/ U: V* n! gcross_marquee.innerHTML=marqueecontent
; F2 G" ^$ Y( Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 q1 C& j/ ~ B7 @1 R7 e! ?}
" z+ f* ?- h9 \/ {) }* b7 Qelse if (document.layers){$ X8 Y/ U0 ?& P: |
ns_marquee=document.ns_marquee.document.ns_marquee2
8 U& i* p; c1 q. M9 }, o! pns_marquee.left=marqueewidth+8
, k9 F7 W; c b8 F# ?! `, U% q9 c/ lns_marquee.document.write(marqueecontent)
& D4 N: F4 M: Lns_marquee.document.close()3 w6 s- z) M$ s4 Y! d1 l8 S) S
actualwidth=ns_marquee.document.width4 ~8 }2 O" o7 l! S* `( R
} |9 u4 i; i; m/ T
lefttime=setInterval("scrollmarquee()",20)
/ Y9 Q# V4 q! e}; b: n; H8 m) N8 h' t
window.onload=populate$ x! ?3 X+ R3 W0 ~1 |
' l9 h! x& l0 M8 z6 u8 l
function scrollmarquee(){- \9 A9 k; C4 R9 D8 Q) ^
if (iedom){: x5 u+ K$ t' |, Q# H' v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# Q3 p) J+ F3 z3 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 R, @3 V. o% ?- K5 e
else
) M+ J1 M* |( |/ c; {cross_marquee.style.left=marqueewidth+88 k8 e y* i1 C f% m& ?6 l
$ }0 y( d0 W0 Q
}
( p+ \# ~6 a& Y* H% w9 `else if (document.layers){
4 q/ E5 B* W2 Y3 ?% qif (ns_marquee.left>(actualwidth*(-1)+8))
c$ q% J6 `% I) ~9 }- s; K* gns_marquee.left-=copyspeed. u2 C8 M4 g6 P8 E. L1 I
else4 d$ M+ r8 Y; m# U) W% J" y
ns_marquee.left=marqueewidth+8
6 X; u2 c7 {' W/ @}3 t0 T G/ U6 k
}
: ~; K. ]/ L6 n! |: G; e; J$ m
$ R% [3 T7 Z6 _8 p; V cif (iedom||document.layers){
2 |( {, Z4 @4 j2 b1 e) Ywith (document){
1 V" v7 b% Q. L2 U, ]' Z* pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; o- C( A! z H/ U6 eif (iedom){1 d$ [0 p8 H' k* L9 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& B+ D' g( E0 |* l( u8 c$ m- h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
N3 C# O3 N6 L8 jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# D0 t+ e! G5 Z5 p2 Gwrite('</div>')2 } w! F/ T- O; ?4 `- M
}
* j9 y; \# B. [else if (document.layers){3 B0 f( Q, P( ^( E: ~+ K& W [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 ?* |3 R2 N6 s4 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! A, v3 x' |1 G% D9 Qwrite('</ilayer>')% y' S0 I+ H/ {& y& D
}
$ t' O7 s' ~+ u! ~; idocument.write('</td></table>')
" ^7 F% H/ ]+ x( E/ w: X& v}0 q: n' G2 P5 m
}
2 T+ q% E& p+ h( s, }</script> |
|