返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ u8 D8 s6 h4 u; {) N0 n
var marqueewidth=300
( ]6 [1 `2 G& Q& h5 ~//高度
" w, }3 x5 l+ `2 F% y- j; |var marqueeheight=253 M& p8 k  _/ X2 Z$ b
//速度(1-10)
+ t) L. T9 Z" U  C: X8 Q& c( qvar marqueespeed=3
' M) Z. O0 Z5 w5 K//背景颜色# ]& r6 }/ l* ^3 R
var marqueebgcolor="#FFFFFF"+ j3 B8 _; n7 ~
//是否能暂停 (0=no. 1=yes)?6 l& w- @8 p3 C& Q; T
var pauseit=1
, Y9 A0 h# C* j& J6 a& u& N2 s/ q, ^* P, ^3 l9 ^
//修改显示内容) m! H0 ]' d0 _( z0 v4 k: Y3 l) j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 s6 l6 q: n, R4 ~

% t2 c- J* C$ {2 T+ P, E# F( H" `6 ~) s0 g4 z6 i/ K. P
////下面不需改变////////////
7 i! n4 O; N$ [# n: o" j2 K3 @
! _, i+ s! |; Nvar copyspeed=marqueespeed
1 |& \" b- ^' W0 Cvar pausespeed=(pauseit==0)? copyspeed: 01 ^) C: ?% u6 u9 X3 h
var iedom=document.all||document.getElementById( ^5 T. d4 `9 z3 w$ u" \# _
if (iedom)# j" y1 I( E& N  O) t# m' o- F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 |( D% z+ b* j/ B0 ]
var actualwidth=''- n" Y1 O7 R! W
var cross_marquee, ns_marquee) T4 V2 \. T( [
4 y, ~. c, i4 ?8 r* K% s, s
function populate(){
& E$ u5 \* E; U9 n/ [if (iedom){
4 [- ?" y! n1 y: Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ i& X2 F! D/ Ccross_marquee.style.left=marqueewidth+8
6 U- Y% G. R8 k7 t. _6 q0 c/ ^cross_marquee.innerHTML=marqueecontent, q1 B$ d# I7 T, j$ ^: W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ ^8 p4 q7 [& m( b2 }
}
- b1 D' h: ]% N# t) r5 eelse if (document.layers){
3 g7 X' f7 u3 lns_marquee=document.ns_marquee.document.ns_marquee2  p/ P0 z& D  n9 H9 W
ns_marquee.left=marqueewidth+8+ ^6 F1 @5 v( q* F# v( i
ns_marquee.document.write(marqueecontent)
0 h  C2 s0 B' _% z! |ns_marquee.document.close()" y3 r, W  \  i+ L- U# ^, [8 D
actualwidth=ns_marquee.document.width4 T7 c$ [# G8 o# M3 V( c) A8 f  f
}  v& A! e# p& y3 T1 g% S7 s6 @1 F3 H- {4 }
lefttime=setInterval("scrollmarquee()",20)
5 g/ p1 Y# U) M6 M}
5 k3 Y% }, `; q! a4 k$ f0 M& owindow.onload=populate. R* `& l. X" D2 l

  x8 }9 Q! Q- p& G' |; s3 W- Yfunction scrollmarquee(){8 H4 l4 `; i/ y' {6 u0 s
if (iedom){
2 j1 ^6 @+ H' G3 e" s! h: Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 w8 M* p1 z' j1 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 P" j. m) {1 o5 telse
  F: V, d+ p+ ?- o& Y/ d5 @cross_marquee.style.left=marqueewidth+8
* Z; I+ ~. L! j/ n$ d
7 U$ ?: T) W% m" I}
$ e0 y2 e2 |. V8 `else if (document.layers){2 w6 a/ Y1 L' i  q8 p, G% B
if (ns_marquee.left>(actualwidth*(-1)+8))
" J7 \" }% V/ H8 R: }) cns_marquee.left-=copyspeed
" e6 \7 ]* A1 d7 relse
" |5 x( e# j, c1 v  R( Lns_marquee.left=marqueewidth+8" J' g1 u. e. M1 ^1 a5 C
}
% ^% B5 z! E, T}$ J7 w  l+ n! O* K
/ P. T4 V( c* y* H( L- _% ?$ t
if (iedom||document.layers){( Z5 S6 w+ S0 T
with (document){
/ N5 }& \2 u" Q2 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): F$ F, \, b$ ^+ _' V
if (iedom){) H! Y+ p. L3 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 o# B) |5 R$ S1 Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 X$ x* j* W: ]$ a& pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( x/ w$ y; v. o- x2 t' A+ p
write('</div>')
, f  ?6 u. U% g0 h7 ^1 r}
% P4 F' t4 D, I/ ^0 A0 {else if (document.layers){
$ y. U. W+ E, f* e" X4 s8 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: c" F, t- d* f" n  I4 [, u" B+ Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 i; Q! W) @/ K+ H! M; Fwrite('</ilayer>')( ^- Z) t# ?5 e% v8 Q0 ~! d( C5 ^  l- Y
}/ w1 H2 S, F9 e3 u0 d. o
document.write('</td></table>')
) i8 }/ ^# `( |& W}
& i3 E5 J+ t7 _+ U: T, S}
- Q& r. i9 V1 n$ A</script>

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