返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 T! Q# g3 ]7 N. r# J' k; A! S, Cvar marqueewidth=300) C" ^3 r& l2 G( W- I4 M
//高度$ j! c, o" t3 V! N' R4 n
var marqueeheight=25
5 Q0 F: v* p$ W1 Y//速度(1-10); |) ?, `- y! E! R* e
var marqueespeed=3
) F1 x' s( L# i6 H! p# n7 i4 o. [//背景颜色
+ g6 A1 f: ]* ?5 s8 Cvar marqueebgcolor="#FFFFFF"
% W4 Z3 P8 b+ f1 f2 x7 r% j. z//是否能暂停 (0=no. 1=yes)?# C1 G% `5 E, U
var pauseit=15 |5 H- P( L9 g' i2 F$ @
, \* U7 u4 q& m, P
//修改显示内容
" G2 r8 K* L3 S2 X$ P: L' ^9 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 H( |: S3 [4 W+ g6 z9 n

! x  b& o- ]- T0 K8 f& c6 x" a7 E  b: ]! G* F
////下面不需改变////////////+ J7 m, g1 K! C6 X( C. r1 \3 W
5 L, T, N# v+ _3 w
var copyspeed=marqueespeed
' o+ z! G% G& y: lvar pausespeed=(pauseit==0)? copyspeed: 0" R" b( K# o: a& B
var iedom=document.all||document.getElementById# ?1 G$ G4 Y2 I' P2 ~# s1 {# M
if (iedom)
* \0 T% N" e8 Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. b$ U$ K4 v  }& V( e6 wvar actualwidth=''
  n) R- u: c$ ^  `/ n8 p* \: S! d/ zvar cross_marquee, ns_marquee
, f/ \' [6 V) M& j4 g/ f# G4 y
# k6 d7 {" A5 `5 b, z+ V: C1 _function populate(){
, l* O, f: t. Q: {6 `* Zif (iedom){
0 c4 t* S' |0 q2 Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 m* k2 d' N$ l0 Z1 F; Lcross_marquee.style.left=marqueewidth+8
2 P6 C$ V5 A6 r) Ycross_marquee.innerHTML=marqueecontent
! ?3 m0 i' h8 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* O8 }4 {  o; C2 c# |% _$ E* e
}/ z# ]) `4 e& u' ~1 O
else if (document.layers){$ W/ L" X5 c4 W" a
ns_marquee=document.ns_marquee.document.ns_marquee26 m1 c/ D2 I3 R1 I1 ^# \
ns_marquee.left=marqueewidth+8
: r9 v: v& ^' E2 K% Xns_marquee.document.write(marqueecontent)
8 X' P0 i; i( b) y5 q  kns_marquee.document.close()
, r& g/ m- L6 `' _+ @actualwidth=ns_marquee.document.width  G& k- r4 b$ |& E- ~" j6 b" H. K
}
) n* ^" Q3 b! Slefttime=setInterval("scrollmarquee()",20); q' o6 ~! `& _- _! p1 b
}2 J0 g; ?; r3 Z" f4 Y" }
window.onload=populate
$ x! s  S8 N$ w. D" \
3 c: B$ p" W7 V2 d2 }, N. z4 Kfunction scrollmarquee(){, D0 O# Z% O7 s; J) h2 N& m4 \+ T
if (iedom){
9 T( x, ]6 V7 k0 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 F! o, L( I9 i) Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; l, f& [2 N( i( O% R
else
$ ?2 ^/ {" e' j3 \: ~, fcross_marquee.style.left=marqueewidth+8: v( @2 [7 G" U" P
& e, N8 J3 {, u3 I
}& t, Q. q/ x0 z( v) e, {" F
else if (document.layers){
2 f* v$ s7 |+ i% H/ Sif (ns_marquee.left>(actualwidth*(-1)+8))
2 s1 I8 s1 ?9 t  D* Yns_marquee.left-=copyspeed
7 i# v4 d, [& L8 pelse1 E* M; G" W8 t/ y% o" Z4 W
ns_marquee.left=marqueewidth+86 ^1 b  X% t$ D+ U: C4 V
}
$ r2 k5 U' z5 a, i+ m8 i  n}7 K7 x9 k! }) B
  r  q) t( I0 `  ^  F1 Z- O
if (iedom||document.layers){' C3 u$ _- y. \* u# Q) Q& L
with (document){) j: o( ]0 j- P% E9 k; T2 i: V9 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 _% _2 J& ?: x9 d1 u# z
if (iedom){3 O% |' @$ L8 S) @1 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! Q$ j2 O  [2 ^0 x' ?6 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! t+ O8 L5 g% Z6 \. g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 o/ B6 G$ ~! f! T* F* I( wwrite('</div>')4 v. D  i) {; {; l! H* q' ~2 m
}
: r- g$ m# [1 k) c" s. z( l6 F; _else if (document.layers){
9 P7 a0 f8 G$ [0 n+ A. o& jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# N7 n  ?; b6 O$ M0 f- k' w# nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 W: c# X8 N4 C0 [9 t& v+ Owrite('</ilayer>')" W8 f- ^# Q0 T! L# k
}+ X) R( [8 w7 U( y0 L
document.write('</td></table>')
$ U" R5 _  O8 |4 W}5 u- o3 E+ Z9 t# d9 M( ~
}
2 ]2 p) l$ O! ?1 Q</script>

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