返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, T. x( c8 n  Q* a3 e' h9 f( Svar marqueewidth=300- v  q1 K* b$ v* h+ W  Z' ~
//高度
  S5 }$ b5 Y7 l0 p+ zvar marqueeheight=25; K6 p7 C( Y$ y7 L# c$ W; [
//速度(1-10)# v7 t, n' y. k( b
var marqueespeed=3( ]1 d# \, U) a1 C. ]/ @% I
//背景颜色- Q% Z. y$ Y0 N. ]
var marqueebgcolor="#FFFFFF"
& [  R9 k- e! b//是否能暂停 (0=no. 1=yes)?( E) M& U" L4 r2 ]; C5 c4 @* Q( Y
var pauseit=1
+ W, r; i  V7 `, d0 G  R
$ K" Z: E6 D% j( {//修改显示内容) Z) u; B0 p6 Q; X9 O! s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( w1 }1 j7 |1 t+ ?% C' b

9 F8 h& B: _) E" H) z9 v! ~  b, |5 L1 z, B/ H" r/ x. ~
////下面不需改变////////////
8 e1 H) g1 E: M* v2 t& l, u& M8 A3 ?! d: b+ Q6 u! B0 n9 N8 k
var copyspeed=marqueespeed4 V* t: K" p: k, F
var pausespeed=(pauseit==0)? copyspeed: 0
( q4 s2 \/ f$ B, B8 m6 G: ?1 Bvar iedom=document.all||document.getElementById3 n- w( X4 n8 g5 k& v
if (iedom)
7 b" P9 y9 n9 _4 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  w8 J% G: x3 i* X/ K
var actualwidth=''" S4 {; q* `2 w
var cross_marquee, ns_marquee; V% x; h  L6 U5 |- ^
6 H3 O3 y& _) n1 R: r9 t! K
function populate(){
2 b: S/ z8 B( e! A% _if (iedom){
9 s# N$ K+ X( m0 |) a, S7 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; m& ]7 c; h* a# \% ~- R+ ^5 b# icross_marquee.style.left=marqueewidth+8
9 u: W, C3 e- ncross_marquee.innerHTML=marqueecontent
$ o1 V$ f8 w* V% Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ V  A; q4 c( f5 y2 x
}$ o3 k" p& Q0 T' u3 Q0 x" }0 G
else if (document.layers){0 ~( j/ q  O  f. D4 H
ns_marquee=document.ns_marquee.document.ns_marquee26 Y$ S% q$ {  s- {; `7 h! p4 e
ns_marquee.left=marqueewidth+8
- i0 x/ B6 m; zns_marquee.document.write(marqueecontent)6 w6 k  ~6 j. f/ B! `
ns_marquee.document.close()
: g, w+ U0 s7 x+ Gactualwidth=ns_marquee.document.width
* [0 r2 X7 U9 I) D( Y% U}
" m' Y" e  A  \# Blefttime=setInterval("scrollmarquee()",20), z3 }% I! @, ?3 s- U' _% u! o: V
}/ x2 X, ]% U* c, Q3 z/ j$ L
window.onload=populate: \+ W# |3 ?! b- `$ p- Z

! c! h8 V( b1 N: p( _6 ^( D" d; Afunction scrollmarquee(){% t/ l- j$ N7 U$ E0 Q
if (iedom){
8 X8 l- b$ \4 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 {7 w  f! [0 k, F0 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 T- Q% n; X4 e. _
else
# f! M. O# v- G. H6 d$ ^# wcross_marquee.style.left=marqueewidth+8
7 ^% k( `( s1 a( ^$ ~7 M1 \
0 a0 p7 C+ y0 p2 T}5 P, i( d8 |5 r  P( Z2 H+ v
else if (document.layers){. q2 V5 F/ }8 l/ L1 u- T$ i1 v- o
if (ns_marquee.left>(actualwidth*(-1)+8))& J+ Y, n/ M& C/ a8 }! O
ns_marquee.left-=copyspeed
0 W' B4 u. z2 c2 T9 [2 z/ zelse+ \6 t0 {/ y* P+ t& z( b: V
ns_marquee.left=marqueewidth+8* z1 D- N$ s" e2 R! {! f% P8 O
}" l1 a3 h* a3 F* A3 m5 _# @+ P
}* q" K3 z% ^% g
- _# `  `$ x) a
if (iedom||document.layers){
% o% [7 n% r7 @8 o3 u. ~& K4 w1 w' rwith (document){* U# @3 b/ s1 |8 v2 K+ m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 i# S8 {% C0 j# K: X
if (iedom){
- x! G! b' i( M0 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' M' {& c! J+ K& n( ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ s- J& C% N. Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 V( x& t, ~4 v7 ?6 L3 H6 ~+ e
write('</div>')1 u" f: V! E) [0 a( k
}# j$ ^- ^( ^% T# ~+ _
else if (document.layers){
0 _3 Q5 C! B: I6 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% @1 C% Q# a% r- V, t# X' dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. J1 R7 C4 D' N- F: v7 X3 Jwrite('</ilayer>')
  \: F) [$ a- m3 P* j# D+ A}/ m, q' o- x8 {/ T
document.write('</td></table>')5 o: y! H# {' F/ f" j
}; \* s1 x$ U# Q- n( l3 X
}
6 k; Q+ {  J) W0 ~) I+ u2 s</script>

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