返回列表 发帖

网页之跑马灯文字特效

//修改宽度, R1 n1 i8 `  I1 y6 F
var marqueewidth=3001 A# ~  Y! d4 p# ]8 z
//高度
( y9 x2 |) d$ G# d9 Ovar marqueeheight=259 d. q6 }# k% w+ n4 p
//速度(1-10)
/ D, M7 w- v2 r: J* ]) Avar marqueespeed=3* s% |& x4 e. W. K
//背景颜色
* G3 s7 l5 }* w# Yvar marqueebgcolor="#FFFFFF"$ a# r5 @  q( T+ \# H* C7 j& F
//是否能暂停 (0=no. 1=yes)?
9 }7 K7 t- [8 svar pauseit=1
: r9 @: `& T3 K5 L9 H) E; s  ^. ^3 d: ~1 ^# B1 H
//修改显示内容
  i. U  e. ~  K* E( _( p( Y" wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 f* E  I0 N/ s* i% f

; S3 Q# V; i) T% {! t% ]: e1 x* N
& P2 y! K/ b- w. ], S/ ~7 T////下面不需改变////////////) }$ v/ E& m8 P8 G
" W* ?$ s. i2 R' Y8 A  Z
var copyspeed=marqueespeed
; }" _5 H7 [: q% d( a9 Jvar pausespeed=(pauseit==0)? copyspeed: 0: r+ @3 f5 E# D$ L: V' F
var iedom=document.all||document.getElementById. ~, r) E+ P' X* T+ j- g  Y! @# q
if (iedom)
& v% p/ f/ u" K- P" Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 S/ X" k- o2 T* J" I. s
var actualwidth=''- s3 f" S9 r% R! o# n; y- A1 ?
var cross_marquee, ns_marquee
, i6 v8 P- A( ~/ Z, V1 z5 ~9 u0 d, ]! ^2 V* ~( z& s( }% L
function populate(){
5 ^3 F( I! j8 i, lif (iedom){
! N2 K1 c$ s. J$ {" S; V' J4 Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% \3 P5 S& ?/ @5 r; H1 hcross_marquee.style.left=marqueewidth+8
- @! K0 O! A/ }* u, y5 G/ u  Zcross_marquee.innerHTML=marqueecontent* j5 D4 T1 q6 \' v8 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* `  O9 R+ L% z0 [$ b/ L
}
3 {0 j% m9 O& delse if (document.layers){% I# X8 r& z6 x3 \" t+ R
ns_marquee=document.ns_marquee.document.ns_marquee2+ X/ d( E' q6 t; Z% k# R
ns_marquee.left=marqueewidth+8
* y9 c5 ?4 i/ Z" f# I, g+ gns_marquee.document.write(marqueecontent)1 y- ~+ p* I. T1 F7 f9 S7 w7 }  m
ns_marquee.document.close()
; j0 f+ i, D; `( z2 {9 ?. R, aactualwidth=ns_marquee.document.width
1 [0 E4 s6 m  s. U0 e}/ W. B# N7 u; I9 V9 E
lefttime=setInterval("scrollmarquee()",20)& c' G0 [' f! \8 \2 ]
}' o: ]; G0 o' H9 P8 ~5 Q! O# Z5 G% F
window.onload=populate. J: |8 j# Q6 H

, i( _, b9 J! q7 _. z& i; ofunction scrollmarquee(){
$ r. Y" i8 h& Y$ P& Oif (iedom){
% q$ P) }+ c8 i0 s) H- _" {& Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 H1 n) Q: ], Z( g5 y( x( H! p2 ^: ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) T9 _# v0 z8 ]; K0 Belse
! p( v$ ?$ v* I" |' m! Ucross_marquee.style.left=marqueewidth+8
/ C2 O" P  i  _( D# t, D+ S7 O3 |: G$ z
}) R0 B% @. D$ [7 L6 A9 E' w7 {
else if (document.layers){/ P2 E" q# z) r# C
if (ns_marquee.left>(actualwidth*(-1)+8))
3 N$ Y. d4 n$ ^2 t+ h; sns_marquee.left-=copyspeed
1 F. b  [- H* c/ x; ~7 ?  B* Lelse7 F3 L" R* a* c, o
ns_marquee.left=marqueewidth+8, h! j- w% I7 ]
}
# J, S, l' g1 i}- M5 S2 M6 Y- X1 H% e

) K7 e- k7 h1 \# }' Y! lif (iedom||document.layers){7 e. P0 }% q, q$ b! C1 P
with (document){
9 n) G/ ^# L+ q6 Z; m) s8 \8 bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  f( _$ ~! [2 V/ R% H) X
if (iedom){
' |& d' w' t9 ~" awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" c5 U2 i6 g: J' e  N4 v6 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ?" |( u) z8 p4 p( M7 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 l* f) E/ I' ]' @& R; d
write('</div>')
5 L' W$ S' x! ~1 Q& S}
1 ]& h- U' z# y8 j. z. d4 Z1 C/ B" Q. Gelse if (document.layers){" L: `6 e* K# ~, l7 e6 A4 n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 x$ Q6 b8 ^, w& M3 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ {  W1 i9 c0 h2 x, j1 n* [" B4 t
write('</ilayer>')
; g, f% }- G- Y" L5 \' F3 W}! I. d- j% z; L
document.write('</td></table>')" N0 r) Y; m" m! O! p
}
; Q0 X- ^4 ]6 T% j* U}
" H0 R6 N6 ~6 L/ A" A7 Q</script>

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