返回列表 发帖

网页之跑马灯文字特效

//修改宽度: T  S5 i% z# f
var marqueewidth=300
8 G0 T" U6 }" v4 s0 \4 x//高度- C4 s4 j3 Y' v* N, a, ^
var marqueeheight=25
9 [; u: Y3 |% N2 @3 E//速度(1-10)" y. B! i9 z) R* R) t  e
var marqueespeed=3
4 ]& L" X# K- ^/ q5 X! l//背景颜色
2 b/ {2 G0 O, ]var marqueebgcolor="#FFFFFF"4 W- Z; J/ n. `( o; D; p8 k
//是否能暂停 (0=no. 1=yes)?
, w8 h, v$ [! h( K. Rvar pauseit=12 t  [9 f. j* n! B6 }9 F: O
5 R- `  {$ I5 ]- V  a
//修改显示内容: A; P* d8 R+ r  F+ s0 S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 \) U. Z5 Y. I) h* R

9 M) P5 q0 V& E4 p# S& E
! J" D! N5 W4 S4 ?4 S////下面不需改变///////////// g& p$ Z7 Y5 r* \+ h7 r; y; z' b, c
+ F* R) e0 M. _' [; p0 [; S
var copyspeed=marqueespeed/ \. B2 Q) `6 R2 n7 W) P4 h9 {! O2 d) g
var pausespeed=(pauseit==0)? copyspeed: 0
& x, h5 K" `  C4 `2 E+ V3 j) N3 ivar iedom=document.all||document.getElementById
' b3 D4 u  ^, r- O+ Q+ I6 cif (iedom)
: @5 S1 |1 x  b! l8 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" r1 m, u; b7 L# L) X& P* v8 \var actualwidth=''' n' S- l8 F  r5 w
var cross_marquee, ns_marquee" b) M0 q5 c% @' F5 N1 M

5 f6 I/ o/ ^, T9 C! s1 G5 nfunction populate(){/ }# P( @: u6 c
if (iedom){. q. d$ n  f- P3 H9 t7 c5 x9 J. D" t$ J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 ~, I6 v% N/ B: g
cross_marquee.style.left=marqueewidth+81 Q" [( r# E- _$ x0 I. K: [  K
cross_marquee.innerHTML=marqueecontent
2 \* |% R# p- _" {; U4 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: q2 D* m0 ?  R) T- i' x4 S
}
' V/ }% D2 X. |5 `1 f- `: e8 g9 ~% pelse if (document.layers){
! ]/ c; f9 ]2 G+ r+ `ns_marquee=document.ns_marquee.document.ns_marquee2
8 V- n- a, v2 f( nns_marquee.left=marqueewidth+8
7 [& U8 M9 G! W9 |, i0 uns_marquee.document.write(marqueecontent)
+ p9 U. h$ o" S7 |  bns_marquee.document.close()
2 s3 T+ _, t2 O* Y' T" f% ~7 \# Ractualwidth=ns_marquee.document.width. R5 \3 J' V& K& }: X
}7 b0 u' e1 P6 _; F
lefttime=setInterval("scrollmarquee()",20)
; k. T" ]) z6 t}# \* p- G; {6 G+ e
window.onload=populate. S  |9 f8 g9 K3 R" Z! U% l

# R0 H( R  h& z4 f* A: U' H7 i; gfunction scrollmarquee(){
3 I) p, f1 G! P( u( N1 F  zif (iedom){
/ f  @2 \' J5 h  j: T+ A8 o" x$ eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ G2 y+ c" O# o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 A7 G& X$ h1 E/ Z2 b* Belse
# A# J) x8 Y( q% l  q1 z# h7 a4 gcross_marquee.style.left=marqueewidth+84 W3 f; A" B5 o' o
$ [/ c+ Z3 j& G" y" c$ [2 u
}
7 M  e! u5 T' T% S  g) C8 Y0 k) qelse if (document.layers){* C. R; N) w( l6 E7 i
if (ns_marquee.left>(actualwidth*(-1)+8))
" e/ S, K# I6 Jns_marquee.left-=copyspeed
2 b" D5 @8 k4 l" ^+ @# N. x# F( ?else$ \+ l# o. ]& k: d
ns_marquee.left=marqueewidth+8
% V; H+ N+ C0 O" ~2 m}
) m9 {4 {! |$ w; c, |7 l}
  I6 I9 m8 N+ A# U4 g$ j. L/ D
& f+ o) D- |) e0 T$ h+ j2 eif (iedom||document.layers){
; O) ]& n+ L% j' u5 [" Kwith (document){/ P, |$ e: x. U& U, @' @/ e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 z, d" _' f5 [1 `7 kif (iedom){
" j+ \8 d' e( G- [4 v: h, s( Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 Q2 g$ e% y* }& zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. P/ b$ H/ @6 {  Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 S6 |; l8 V3 N, swrite('</div>')
7 O7 f+ g* |9 ?) C; u' Z}) H& m4 I6 ?( w) ~
else if (document.layers){  ~# K; B( u, w# h/ ?0 V) I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 {: K8 K- c# V, a+ p0 G% L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 b' ?3 g9 t) C4 C, Gwrite('</ilayer>'), j* E3 v- \1 s- Z' ]4 E7 @
}9 w; X1 g# N$ {1 n% M$ S) N
document.write('</td></table>')
  S' A' A* a) j+ q, Y2 r' u0 |}; G8 a( v& Y6 Y0 |
}
7 X# y5 {& x* z) ^* G. T- U</script>

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