返回列表 发帖

网页之跑马灯文字特效

//修改宽度; e6 [' b$ F0 r; a; j
var marqueewidth=300% ]3 s8 g4 J2 t: g3 ~7 j
//高度
3 V$ G, r5 M4 n+ Z* mvar marqueeheight=25  K# p* z$ G7 k( c3 u& X! P; {
//速度(1-10)
- R  ^5 D7 I- H! |0 y* \9 l; S- @var marqueespeed=3* T4 ~5 d' z* _# V0 C+ V
//背景颜色! M; b* H$ C3 h- Y+ o7 A* S; p: [' i0 O
var marqueebgcolor="#FFFFFF"0 D4 D, }- Y8 g9 ?8 s& E+ H
//是否能暂停 (0=no. 1=yes)?5 r. ^+ z8 ]% |5 p5 h
var pauseit=1
% A$ {& F  |7 Q/ ?$ {
) M/ j( I8 L+ p" Q5 Q0 ^" Q: ?//修改显示内容
9 _" j5 U( [: }$ `" d9 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 y. W  w7 N/ J3 {" K: v, X, |; Q( M6 K9 M2 \: g! q3 n6 E* U
% L2 y5 l' \4 ~
////下面不需改变////////////$ k2 h) b! @' E( s. k6 k* i8 b% n

+ G3 }* n& `7 S" ?var copyspeed=marqueespeed
# `* z2 \- }4 X8 _' [  q. [5 V% w1 xvar pausespeed=(pauseit==0)? copyspeed: 0* P. Z) ]! b+ z0 r$ x
var iedom=document.all||document.getElementById
6 b9 s! x( s! B9 T& E* d4 B! `if (iedom): h1 ^7 q' h! b# ?( u! y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) S+ u. H0 ~; b+ c1 x/ Z" k2 @var actualwidth=''* j! r6 \8 M6 h) _
var cross_marquee, ns_marquee6 _% A7 W9 p. u" }$ I
$ r( I! j, |; m# d; {! n/ @
function populate(){0 ]% r5 D$ u+ s" E
if (iedom){
- R0 O7 ?3 {  r8 i2 h% t' R& V  H$ ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 d- M9 U$ g+ d0 Jcross_marquee.style.left=marqueewidth+8: K8 j6 u" G; U' f+ Y2 Q
cross_marquee.innerHTML=marqueecontent
- ^0 w1 u# Z8 L) C1 m2 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. p4 u3 y2 I+ K}. y9 |& ^4 G# d3 N3 j# g9 Y3 K2 H
else if (document.layers){1 W- u) B" A) n* b$ S9 S5 s
ns_marquee=document.ns_marquee.document.ns_marquee2
0 _2 I& _# y( E' jns_marquee.left=marqueewidth+82 V6 q3 K# n3 ], z2 ^3 m
ns_marquee.document.write(marqueecontent)
; K+ U0 _+ V- a4 }. w# Z1 U- F: Rns_marquee.document.close()
5 S: I9 P/ E: |actualwidth=ns_marquee.document.width
/ q# d) s! J4 r) Q: l! g}+ N; k" u  \0 x% f# x/ j. }9 N
lefttime=setInterval("scrollmarquee()",20)
# }4 S0 p: X  c$ O6 t1 s}: P9 f4 T1 P. Z
window.onload=populate
7 L: z5 H& ?6 U% w" _- ]: L! k! F' F
0 C' l' w# r; a; `; kfunction scrollmarquee(){
) ^# t% X! g& @( j# C7 f9 Cif (iedom){" C; p5 u  {5 g6 b- P9 r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 T2 H0 W! Y3 {2 `7 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 K* F2 J/ e( K  s$ Celse9 H. C) h  I* V! S
cross_marquee.style.left=marqueewidth+8
2 C3 b+ ?  P) K% _. `" ~9 X
" b( O" a2 I: _! \! U) @}
% q8 a7 h! E; f$ f. Welse if (document.layers){0 b" c/ J5 o& i/ `8 ?4 R! l9 H2 e
if (ns_marquee.left>(actualwidth*(-1)+8))
6 B$ o" q- @+ B  P: n3 m  Q3 ons_marquee.left-=copyspeed4 X5 G' I$ h, B, w4 M) r  q
else
+ n) t5 C- w3 D/ I: zns_marquee.left=marqueewidth+8
& H) |, f2 Q) k/ G}
  O0 D- m7 [0 B8 y/ p( l0 G}0 R1 v0 F7 E  G" A" u  z, Y
1 y3 a; S. w1 O
if (iedom||document.layers){
' |! |* o7 {/ ^0 q' D! iwith (document){- Y! W9 h6 I' K0 t' i6 `4 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& J, P+ m) _& A7 Pif (iedom){
' G: S5 ]# N! A! e+ c7 Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ Z/ y" @! i8 G4 b  [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 t4 e0 F4 {. X( ~3 ]+ F! k# r7 _8 h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& a) ?. |$ t. v9 s9 x
write('</div>')
$ {: m( O8 l" a' s7 o. D}
8 h" h' ]; x5 welse if (document.layers){4 ?. }3 i8 H; y: s! r2 o/ G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' ]+ e0 t; n' |  U% G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' ]' C7 q# z: @( ~* B3 b, R- M' Q
write('</ilayer>')
9 X9 [1 Q4 J6 \1 o: F+ R$ I( \}) t1 Z8 T& \5 w
document.write('</td></table>')( |5 X, `0 A& X) {  R
}8 v' H) }+ C; t! d. C, f  O$ _
}
8 q7 s2 f* {) Z$ S3 V. e</script>

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