返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 E6 c( O+ F# V0 ?3 x! h1 i
var marqueewidth=300
: Y& s, G% b$ I' v  w+ _- n1 w//高度
% i& U7 I8 c; _( e+ Ivar marqueeheight=25, L4 a  B) `. Y0 t" s9 ~; [) b* _
//速度(1-10)3 q7 r, ?4 m" ~9 P/ R
var marqueespeed=3
& [4 @/ v+ G) @//背景颜色3 H. \9 S' \6 ~# z
var marqueebgcolor="#FFFFFF"/ ?$ \8 D  z7 t! |. U
//是否能暂停 (0=no. 1=yes)?+ E/ E0 _5 ~; L( i! g
var pauseit=1; N8 m! \. Q$ h; b* t
( l$ d2 G; m) U% C+ E- p
//修改显示内容
+ E6 Q* K  g9 ^; z2 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* u  L4 h3 a# E2 A4 c+ \
% k# I% I( k8 R/ M& `( K/ W# M
" j- }1 V# s# [# r6 S. Q% |7 ~////下面不需改变////////////6 \5 M2 @* q& {' f7 k

- @8 U1 ~$ a% T' z. j  Ovar copyspeed=marqueespeed
, n  m8 C" R% N) A3 F! L7 f7 H  _var pausespeed=(pauseit==0)? copyspeed: 09 P) B$ r8 S2 Q
var iedom=document.all||document.getElementById! F7 l( q. A! ?# u2 e* h
if (iedom)+ Z  }, t% s) n* F$ [+ ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 g+ _( _5 s2 x6 S! @  d. s- evar actualwidth=''
1 W8 ?, a1 V& t2 ~) V4 x' t: ovar cross_marquee, ns_marquee2 j2 S/ T- U+ d; e- U7 D

, A: o8 j# g% S8 }function populate(){
7 E, j: z3 f! U( @+ o# ?5 }if (iedom){
8 }- g! W% |% F; N' W& M1 h$ J- lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  q" M3 s8 c! e/ W0 U
cross_marquee.style.left=marqueewidth+8. N) K# h) b' s. @
cross_marquee.innerHTML=marqueecontent
% ?# F1 b: [- u8 D/ ^  Y9 X- m, Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" ]5 f% N/ S! l, c}$ E- c# f7 u% ?  E! x% n- ^9 q  n$ \5 ]
else if (document.layers){2 u2 b! U% T5 P( C
ns_marquee=document.ns_marquee.document.ns_marquee2" Y. d' I4 [3 |9 o8 w8 L2 G
ns_marquee.left=marqueewidth+8( g# z: r2 c4 ]1 h3 q
ns_marquee.document.write(marqueecontent)7 Y/ U0 D! m4 D
ns_marquee.document.close()
9 |4 u2 q1 n! U( bactualwidth=ns_marquee.document.width
- H8 O  j4 r3 L: M% ]! [% E  B  O}: d. G9 s# S0 [3 z% B. E9 |1 @
lefttime=setInterval("scrollmarquee()",20)
" h8 ^) h6 `0 c6 _}8 X8 ~( a' x$ Z
window.onload=populate
0 m: e# K3 l- z+ I  {" G# Z  E* C; Q( e3 W! n
function scrollmarquee(){
# Z3 I4 E& x$ w% q1 n+ F9 Lif (iedom){* z5 u/ F7 W) q( Y$ @# j2 I' a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, A. |* T$ U4 V1 C4 K" k# N9 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: e5 y; J- r' g" v$ P
else
! z% T7 g2 Z" m4 icross_marquee.style.left=marqueewidth+8
# g- u& d% s; J( d: t% N8 d' G
; m( t5 V4 R2 N. C7 W% E* |: u5 e$ b}
9 R: U& H/ v* B3 `' pelse if (document.layers){
: S5 ]8 y* {3 g2 A3 |1 Sif (ns_marquee.left>(actualwidth*(-1)+8))6 u; [! A* {5 a! V
ns_marquee.left-=copyspeed
7 E6 e4 `; t4 G+ x0 N! o" Eelse
! [( _8 W" n$ p, y! i. _; A* [" ^ns_marquee.left=marqueewidth+8& K$ _  W$ K/ Y" ?
}
2 ~& k# C3 K6 P6 V& g}4 d5 l6 {: n6 T, j
, C7 `5 Q/ P0 ]# b# F0 u
if (iedom||document.layers){+ Y' ~, q- a, ]) P7 v
with (document){6 Q6 o5 @: I( y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 {9 H8 q. x" I1 V% o3 X
if (iedom){( f  G$ {; L6 ?( _$ U$ A% D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" ]4 e6 V1 [" B) A/ e9 I3 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' U* k! P# U" h9 f3 `2 U5 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- }) P+ U$ V1 n2 _( G
write('</div>')
2 n  G) i! G6 c0 i8 Z; M( A' r  M}  Z9 t9 ^9 n* H/ ^2 ?
else if (document.layers){
' ~! W" U4 T$ U6 ~3 z7 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) {' ^+ l6 U0 v7 D1 b1 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); E/ ^& ^# m# D" |3 i+ D4 M" m
write('</ilayer>')
; |3 s2 E5 [1 y+ ]" C: U) T/ J  }}; b1 t6 q* x; E9 Y/ {) j8 r7 Z
document.write('</td></table>')
& ]: f) ?& ?7 @7 w; \5 O}8 p& |& h1 `: _) L$ I7 O; H
}9 u; v8 k$ M  _& r) [' a6 X9 Z* M8 h  ~
</script>

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