返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 I' Z9 c: W/ B# {
var marqueewidth=300
+ ]6 Z& k, w4 X  x//高度
. W9 |: z2 z, {0 n7 p) ^var marqueeheight=25
+ g8 G3 B. ^- k5 T" w//速度(1-10)- J% y/ u* [& B
var marqueespeed=3
) ]/ }4 S( k& t( b! [& c; V  g//背景颜色
) a, S- L! o8 j" ^( N; j4 T3 Gvar marqueebgcolor="#FFFFFF"8 R! g' g! W. f; K' U
//是否能暂停 (0=no. 1=yes)?
  f& E8 M3 r  ~/ ^/ avar pauseit=1
6 S, U, v) i. K+ S3 X$ A  g5 t  [( l
//修改显示内容
3 [0 J$ ^, y! q& W; M! Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 l2 A' o+ e) ?4 B

% q& y4 [! |/ c$ v" U" ?& w. k. Z$ d$ I+ A
////下面不需改变////////////
2 x& i" P% v8 N! T
9 A4 h1 m; e0 M) h% W9 ]var copyspeed=marqueespeed
4 D. ^# a: h0 d& R$ Z, n; hvar pausespeed=(pauseit==0)? copyspeed: 01 Q* `' i. _6 k+ @" A
var iedom=document.all||document.getElementById
  \0 k- b0 [0 X6 c0 Fif (iedom)2 |8 H. h: e. Z. c) Q  W; o9 u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ o! W( g1 {  w. V) S
var actualwidth=''' D. D/ h1 R% j4 G
var cross_marquee, ns_marquee
( ?( i$ v. Z$ q( w% X+ C
/ \2 B7 n0 H9 M% h' ?function populate(){
, Q2 R) T: C# V9 b/ s6 L3 ?- \& V+ q; T8 Uif (iedom){
1 A( q8 R5 D7 T0 L4 U& x7 Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 o8 x3 x1 I% H2 w3 F  {1 I
cross_marquee.style.left=marqueewidth+8
( U1 B6 ]% K; g( C0 Fcross_marquee.innerHTML=marqueecontent
$ Y  T7 S& x- r$ @5 I& Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; A/ H) L6 F: N: y8 u  U
}0 \# e$ m6 k. q4 r! A
else if (document.layers){4 @1 H& v  Q  C) z3 _2 Y; U4 l
ns_marquee=document.ns_marquee.document.ns_marquee29 E  @: y7 W, r- \
ns_marquee.left=marqueewidth+89 G5 t- p% M0 ~2 }( s
ns_marquee.document.write(marqueecontent)8 D" @( G; ~8 ?4 U3 g
ns_marquee.document.close()5 I$ k" a4 M. c# f; I4 D$ e1 g* k3 _
actualwidth=ns_marquee.document.width
8 B6 \' w: W/ m7 p}
; V" ]+ v7 R. i9 b* \0 Blefttime=setInterval("scrollmarquee()",20)+ K( b' v& d6 `5 Q! h( q0 |0 v4 P
}
* L" x2 q# q; s' P) Rwindow.onload=populate
2 H' f9 \& j! K' y( C5 u& v/ H- J$ c2 L
function scrollmarquee(){, _0 m1 N1 s0 }
if (iedom){$ Q/ o. N: D  n7 M( {- y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 Z( G+ ?: I/ \" g4 K) K' Y( H4 i- `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- `2 _. u, Y5 @: ?* S
else8 ]$ g1 w( D' K  ^" C, m
cross_marquee.style.left=marqueewidth+8
% S3 Q8 X* [# m, j: e& N4 b( Z# G+ T! F- [- W
}
: J1 F" }0 L( Eelse if (document.layers){
  L, X. T; U1 ]2 e+ c( }if (ns_marquee.left>(actualwidth*(-1)+8))
! K! Q; n$ t& [& o! ]8 H- v: |; D& H6 qns_marquee.left-=copyspeed
% y+ O' X" I  C/ jelse
* X0 N$ Y, Y: t6 p* Mns_marquee.left=marqueewidth+80 D5 b' n* a# K
}) ^7 O2 {& S2 a2 g2 B, z! Z6 g4 K
}
+ `9 f: _- N* F( n  U, S& h. [1 s( P9 q; a* V
if (iedom||document.layers){
) }' ?  O) e, h* i: Pwith (document){
. ~. e9 s' W3 S. B; T2 }  H7 M/ ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); q9 j6 O; ^! n8 Z
if (iedom){
0 m5 L$ \5 y9 Y# dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* j; v# ]# Y* \. Z$ h0 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 M5 w3 ]( p' G  ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 ]* ^( t5 ^+ P$ [1 H8 [5 U6 V* a
write('</div>')9 {1 g( n: B# ~) S5 Z
}
. j4 \1 }2 x) Z9 \2 zelse if (document.layers){& L6 T5 P$ w; ~1 {3 c. {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 j- @- e/ l0 ~( ^3 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 w9 g9 S  M. l5 a
write('</ilayer>')
/ q! i% \. K8 n6 y5 W}
& E6 o/ d! A/ Jdocument.write('</td></table>'), j: v; v3 ]( t5 E0 ^
}- T' I+ V2 J' z; C8 \( z; L3 ~
}
8 K% X( Q5 ~: \4 q</script>

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