返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) o& E8 |- O, ]0 @. m) Vvar marqueewidth=300+ i$ k6 ^7 Q. R  G9 O
//高度
+ T5 {2 {7 ]; q2 mvar marqueeheight=25" W3 r. E# {  k/ E, Z9 \
//速度(1-10)
' x7 B% ?) j- h' ^; n) _var marqueespeed=3
" h) g* j0 ~4 H* M# i5 c//背景颜色
  O, a* Z; U: ]9 d' A$ wvar marqueebgcolor="#FFFFFF"
/ X6 U! r' k) d//是否能暂停 (0=no. 1=yes)?* v. V4 e2 x* I3 R
var pauseit=1
7 C- u, z. F5 |* J1 i# }! M8 o: r, R+ X/ a4 I; q
//修改显示内容
* [. A0 F( v: ]3 M2 H5 ~& Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* o6 D# t/ C/ N
. v) _- h+ i; n3 Q$ M! q4 J0 Q/ M3 v( o8 a' q
////下面不需改变////////////
) c' Q# M) i: `+ Y6 h# s
  s) m7 l, a) u+ wvar copyspeed=marqueespeed( y, V: \. F( \7 h  A
var pausespeed=(pauseit==0)? copyspeed: 0+ ~# F; D: a* [4 Q
var iedom=document.all||document.getElementById+ ~. i0 V. G0 y- k
if (iedom)- I. J) G5 Z0 H/ T. Y/ W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 `: p) X- [( D) f+ {& Y& I& Q  ?var actualwidth=''
; W; u' U% w- p0 A1 |! [, _, c  k7 L7 {var cross_marquee, ns_marquee- g) v! c7 c2 H3 h

6 w0 ?) p# _) F7 [) [* {/ s2 K- ufunction populate(){. }8 Y" q  P9 J  {* I& q
if (iedom){
! V9 D! {0 M, [, A6 t5 z3 E* Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& S" x) \7 |$ I( X$ Z; n4 e: P
cross_marquee.style.left=marqueewidth+8
  x7 G5 u# R- a% s: \cross_marquee.innerHTML=marqueecontent, N3 j; B8 m! o9 g0 e( g# J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 Y, C; j- ]2 C: i. R}* n( K$ I8 D7 X+ @# }; J+ G
else if (document.layers){
+ O3 t$ ~/ w: \6 x& Ons_marquee=document.ns_marquee.document.ns_marquee25 R7 t$ z# Q( b* H9 x; E
ns_marquee.left=marqueewidth+8! s  B3 A4 R1 M) M, V
ns_marquee.document.write(marqueecontent)$ K+ a& o. ^1 E; H' o# I. c
ns_marquee.document.close()
5 E/ q9 D5 ^: d& A( {actualwidth=ns_marquee.document.width/ v( S( O; y2 A9 \: ^
}
1 C& |, n5 B( c- @9 m2 u" \4 jlefttime=setInterval("scrollmarquee()",20)
5 S: L5 Z! X, X1 g; a! D8 i$ B}! U! n; H7 d5 [2 z
window.onload=populate
% _+ }& O, X4 ^# N1 q0 z+ K% p( z) d8 h7 v  F9 y6 Q
function scrollmarquee(){
% s/ [; N4 g7 O* {: Sif (iedom){2 A" J6 f" S( J4 C  s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( r- X! n; _0 A# s- e' |/ h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ Q( C1 H/ @( f" u3 B6 `else1 b2 n" N1 p' X4 t4 |
cross_marquee.style.left=marqueewidth+8
2 u8 L; U* `* g4 h. }2 X- ]% Q- z7 a7 P! L9 W% Y$ g  Z; q
}
7 s. ~% W1 C. N6 O" q- jelse if (document.layers){
) k# D8 ^& z9 L7 Z/ z9 C' Qif (ns_marquee.left>(actualwidth*(-1)+8))
0 G5 U9 E* W' k7 J2 u, jns_marquee.left-=copyspeed
# y) t1 e5 l  j" B; g, v- telse, T) T! C; _+ I2 n& d7 `6 m0 m
ns_marquee.left=marqueewidth+82 E* k0 O9 ]# ?- g3 U# y
}1 e0 S" a, M7 u. O4 ]1 @
}4 m4 F6 g! s$ K) n  ?! P
3 y; l; m; @& e
if (iedom||document.layers){2 Z# e; L' m7 h# Y. k3 F4 T% K
with (document){2 T2 d% M& [# L8 x+ D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 M' z* _) [, _, E3 C- b
if (iedom){
- `) i0 h5 D/ z4 T( Z% B9 ?+ Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ M6 w. F2 u, n6 _$ G8 ]7 O3 E3 f+ O$ Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 F8 h# }9 m5 ?6 q+ u+ c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% g1 t" g7 u/ x" H' f
write('</div>')
& N6 P7 ^8 g: S% V6 Q* x}
8 }  A1 k2 B$ \6 z1 n5 Uelse if (document.layers){
. ?* I) |( X2 ?5 }0 n, b0 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, P' n2 F3 K/ S# t( swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 w+ f* Z# o, w  A( Mwrite('</ilayer>')
$ w! N- c) [' W5 L$ s7 S}
) Z9 D! d) y- Q- ~document.write('</td></table>')
, t" h3 P2 _. W  `}
# ?* |; O" u& z; V% g/ y6 J5 e- c4 E}
7 Q& R1 S" \5 U' A</script>

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