返回列表 发帖

网页之跑马灯文字特效

//修改宽度  y+ {7 V: ]. t9 Z
var marqueewidth=300& y/ m4 X5 U4 g# k( C) D; I! Y" ~9 W
//高度
- r) c- y# `: ?) e; t3 T- ^8 evar marqueeheight=255 Q- T0 D/ l7 W' |3 Z
//速度(1-10)
9 H9 ^/ }5 U( q% c! h3 x; O  |var marqueespeed=3
; y# q# H/ f$ t: ^0 U. h  h' s0 f//背景颜色
8 \1 d, C$ x4 E7 F# _var marqueebgcolor="#FFFFFF"
% }$ D/ ~+ O/ I//是否能暂停 (0=no. 1=yes)?( `; w9 F5 p5 `) v5 y
var pauseit=1
" C2 S$ F/ g, H. Q# S7 o8 y) f4 ?) g% l' [9 v9 g& K1 p* w6 X
//修改显示内容
3 Y# q& V7 {: E- K' z0 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 D0 b8 {- F0 D! U+ U( v$ R. K

' |( h* l3 P+ d0 L0 K( p3 l* K7 }8 _
////下面不需改变////////////
" [; M9 e7 ^* W" k$ U+ {- x$ l: k" B& s; R0 K
var copyspeed=marqueespeed
- }$ n1 Q! N1 x! |var pausespeed=(pauseit==0)? copyspeed: 0
( f6 f* A* Q8 z# w0 V1 T9 |var iedom=document.all||document.getElementById/ G/ Z8 q+ K' w( ]
if (iedom)
6 m0 U9 c  \, m# D* Q" i+ l5 ~* Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 l8 x1 |7 {; t- ?
var actualwidth=''
1 Y$ a( h9 r) Y, ^6 ~; A0 x3 Nvar cross_marquee, ns_marquee' @$ e( u6 q) |  {0 _6 m
! o6 {$ B9 D) g
function populate(){: L2 r0 l6 G3 s! I" r; b3 i! T$ A3 O
if (iedom){. p0 u, p0 Q' i- o  G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) n2 ^. C  B/ ]5 m6 G- o6 o; ]5 A% B
cross_marquee.style.left=marqueewidth+8
+ A* `; n; U$ _5 ~cross_marquee.innerHTML=marqueecontent5 B2 T- ^2 g* {- i4 u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ ?' j- P. J; B& f. p}
7 ~! }! H6 E( j- Yelse if (document.layers){
0 L/ C( {' Z( u9 B' B1 fns_marquee=document.ns_marquee.document.ns_marquee2
% D/ Z& E  G# |3 a9 Vns_marquee.left=marqueewidth+8
* J, D9 k1 B; uns_marquee.document.write(marqueecontent)$ a2 ]1 ]8 ]( ^- L* y# s  j
ns_marquee.document.close()) t  q" _+ R1 s
actualwidth=ns_marquee.document.width
, u7 a( s; W1 \* c, E* u, S}
4 x. I3 Y; w% i& p2 dlefttime=setInterval("scrollmarquee()",20)
% s( r5 G1 `+ ]+ C}$ l/ s$ t' _7 M0 P6 G2 J' Z, p5 s
window.onload=populate+ c- {% @* I+ s* o
8 E4 {! h. U3 ~1 ~& h3 I  ]
function scrollmarquee(){
& S! t6 W- u+ W$ [/ `9 E  H/ N1 A, V: ?if (iedom){* B1 k1 C4 M( U0 X' u: i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); c6 Q& _1 F. t+ w# D$ C8 e. i1 ~9 I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* j5 y6 e) ?# R3 J- N) I8 Oelse
' d3 I+ e# ]/ e3 n1 K" Vcross_marquee.style.left=marqueewidth+8
4 C$ x' b2 w3 c7 ]8 @; v
3 ?$ M+ C# J0 ?3 @. v) \# `}7 L0 X$ Y# J) I$ L4 `! Y
else if (document.layers){
" U- ^, H& J& H9 M- L0 `) sif (ns_marquee.left>(actualwidth*(-1)+8))& L+ R; S5 u3 `
ns_marquee.left-=copyspeed0 G! d; d0 q, u$ Z; G! T
else4 c% G* _) d; C# z+ c: a
ns_marquee.left=marqueewidth+85 C9 X3 B( V" ^1 F. P5 m
}( [/ n4 S7 i. u' f2 `
}) n- R0 w+ q  @. @5 i

- K4 g& x% _, o' `if (iedom||document.layers){
9 f8 Z7 m  x2 ?0 Ewith (document){
; F, ^  u  K( e" x* a& b- adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 X0 d5 y- q* i' R6 ]4 j3 |if (iedom){
5 w+ g: _5 e/ V$ A) twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 W  I8 N* B* I5 `0 H* }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ K' l- G! y- v- y5 M$ u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) Q) d! Z" u% T$ r* d- Nwrite('</div>'). K, Q. E6 v0 c3 |
}# |" E6 c2 B( v" Q. C& ~
else if (document.layers){% N/ n$ Q2 M/ v$ ?2 f+ Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) n& [) A* a7 I" z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, B5 o( h0 L" P' Y, N/ P* ^write('</ilayer>')
, ~; m" U9 N. T! K. b/ z}
7 ~. h7 p1 J7 Y0 H$ n( p: ~4 jdocument.write('</td></table>')  w$ ]% @! p, j6 ~
}9 w5 m7 q: a" S5 g4 T
}; k1 a" b+ t0 }* |/ f
</script>

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