返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. W# {. S0 f! evar marqueewidth=300
2 L. o, f: N, C//高度( e# s2 L; Q. I  j( \
var marqueeheight=25
- p' v+ R) Z8 S2 |+ V7 ~( ]9 n//速度(1-10)
( q$ @; R$ ^8 n" \( X, \  @4 ?var marqueespeed=3
7 l  m5 |  P6 ~1 _5 X) s, d//背景颜色3 [7 S* S2 \/ h5 V
var marqueebgcolor="#FFFFFF"; Y/ z& B2 l1 I! g6 h
//是否能暂停 (0=no. 1=yes)?; `1 v( P# D7 t2 E* B6 [7 @
var pauseit=1
  o* ^" ?  V( ?* l4 c! Q: W  d9 |4 @0 Z" T$ U
//修改显示内容
+ J. _4 L2 L& U! m) B  Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 R/ h' n$ W  F5 O

, i4 o5 z. ^5 _. @0 m1 f! n+ q4 [4 I- _0 C6 Y
////下面不需改变////////////
* `: u; q$ A1 E8 g; M) {# s
. q2 C$ |8 f' F( B) {var copyspeed=marqueespeed' n- T# R; @2 Z" D" @
var pausespeed=(pauseit==0)? copyspeed: 0
$ i; o4 F) k0 A  }: K; l; \" Xvar iedom=document.all||document.getElementById
' M0 ^' m: N& H/ `/ V/ pif (iedom)+ v- y) m5 _1 J& l; f/ E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ J) l/ E) R- m5 l8 H& q+ ~8 ^var actualwidth=''
! J0 \: U+ e  r$ a+ Lvar cross_marquee, ns_marquee" }; @. Y: B' J9 k8 [+ O
% ]. E% C+ d! ?; g: ^0 C
function populate(){
. @5 q1 K" {0 W& S- J/ |5 t' ]if (iedom){
. b5 T7 N8 Z1 g8 k6 C/ j2 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; @: X1 R% o8 _; m" k
cross_marquee.style.left=marqueewidth+8
; ?. `- |* \) R& Hcross_marquee.innerHTML=marqueecontent
5 r/ Z2 z, X. [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% ]* T' t! w- e, N6 [8 `}
- L" k; v* Z# X) Selse if (document.layers){
/ R: l3 k/ j( P* z0 rns_marquee=document.ns_marquee.document.ns_marquee2
2 {# K$ l/ n" c' A; Zns_marquee.left=marqueewidth+8
4 O4 {- \/ K4 _, t# J/ x  Bns_marquee.document.write(marqueecontent)
/ s% f) r7 d* l! `ns_marquee.document.close()" i5 H6 P- m$ U
actualwidth=ns_marquee.document.width) e0 [' F- s( _5 p6 S+ Z6 [5 p
}
7 Y$ U$ S4 `) S+ b$ Q0 Wlefttime=setInterval("scrollmarquee()",20)
' W' w- B+ H9 M. y3 i}
1 j' r& ]( R* Y/ B3 |  I# qwindow.onload=populate6 a! s" Z4 ?4 ?0 B  Z* o

% n% g( ~# m' afunction scrollmarquee(){. f7 T! \4 w! F( j3 \% R
if (iedom){* v) b% P( u% Y% a& U& Q4 u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. p' D& X" o% B3 L' M- kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  y- u* [4 q7 H- ?4 Y2 y
else1 H; g0 P2 b* V7 t5 V* J
cross_marquee.style.left=marqueewidth+8* q; C7 F) F- g4 R" T1 m- W' O

6 Z$ b. ^6 ^6 k5 m' N* ^}
) V3 q; O  _2 n9 S. S$ i- U0 @, telse if (document.layers){% ^9 w! C3 J% D+ I, V
if (ns_marquee.left>(actualwidth*(-1)+8))
* C; z) C! A7 B4 B# w# u3 `2 _4 Dns_marquee.left-=copyspeed
+ b# J: k0 }/ l/ Y, T1 eelse% |: ~% P! ^+ O& l9 b8 U- R$ q7 S
ns_marquee.left=marqueewidth+8
$ `& I% X" i2 z/ S/ d0 o}& R- l1 T- W$ d; B8 o
}: C' p0 t& e* V1 K7 a( H8 }# {

+ p' ^1 V7 b+ t6 L/ qif (iedom||document.layers){
' X2 X% i/ |9 O+ Rwith (document){
0 d! E4 @( o+ I) ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 d( z% ]- ], m1 ]- J# q5 h
if (iedom){2 J8 }, v/ U, \7 r2 w$ p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 j' p7 w# \8 b" J/ `$ }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' q7 a  T2 d* X8 m/ X5 {2 r! jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 P$ Z' H, e* ^' o! _- ?3 V
write('</div>'). x( z% w0 D7 m, s9 n$ ^6 W
}
# c4 _# J/ y( Z: Yelse if (document.layers){
' b# Z1 W6 ?# p$ P$ g! n9 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 ]2 j; m+ O' P& G* M/ k3 vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 x& m6 O5 q9 [7 I& Y6 o8 c
write('</ilayer>')
/ A4 I1 N, I- S! A3 Y8 G}/ u7 J! ~& a# ?: R7 z# N2 ^5 C$ N
document.write('</td></table>')
/ B5 m" h, O2 x& e3 S+ h1 L" C}
  ]2 X: p- h1 Z}
6 U% r" j  x; }# G* Q/ Y  x) Z</script>

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