返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 S; I  ?% D! n1 c' _+ K1 p( qvar marqueewidth=300. |/ L1 M# b! C! A  n
//高度' \2 F2 U+ p; I8 [) w; H
var marqueeheight=25
, N6 ^6 J+ X& J/ r//速度(1-10)
5 h$ W  X6 X, ]; W5 o1 q# l9 _var marqueespeed=3
; p" U  [" k: z6 p! j//背景颜色
% ?9 n: T! I. l1 kvar marqueebgcolor="#FFFFFF"
1 X/ j/ ?% ?) e$ r//是否能暂停 (0=no. 1=yes)?$ n. T) v$ r+ r# _# o
var pauseit=1
' _* _% d: w1 `0 P/ o; ^; y( D
. _! {6 e2 r" q: a: ~9 T7 G: c//修改显示内容
6 S- W  {6 w9 q  ?$ F( c% vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 z' v. m+ Y5 ~# c% h; R/ q/ t9 G; B6 R; Q' A4 z- }# @1 l
8 n0 [: Z. A8 S9 y* ^9 |: D6 R
////下面不需改变////////////* C8 h- B  K" g( O: f9 L4 C

1 b+ ]" L+ R/ y1 u. Zvar copyspeed=marqueespeed0 ?% f1 e3 B% \; c- U
var pausespeed=(pauseit==0)? copyspeed: 02 X4 I3 t# Y/ B$ y) G
var iedom=document.all||document.getElementById+ |) c0 m7 X6 e/ o9 j
if (iedom)) C" L- [: Y# Z# K* e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* }4 d2 e/ I6 G
var actualwidth=''
9 u$ o& c, W/ F* P9 h, Jvar cross_marquee, ns_marquee
$ R) M' H3 t$ w$ G# i/ X( ^+ g$ ?# B* O, p+ t" p
function populate(){( ]+ X. x! F' G
if (iedom){- i; k* f9 M8 M6 o5 P9 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; w6 _# E+ H9 p# T( i6 Qcross_marquee.style.left=marqueewidth+8
3 Y3 ~) R2 f( U& D9 f" q6 xcross_marquee.innerHTML=marqueecontent$ P1 K8 D8 w+ e6 O! E5 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- l& l! C& ^# Q9 ?/ w6 j
}& {* s; }- \! H: y
else if (document.layers){) N% w: J2 K& r: h4 _
ns_marquee=document.ns_marquee.document.ns_marquee27 x4 p" X  _- M4 m! C) Q
ns_marquee.left=marqueewidth+8
8 D+ x% b6 _5 H7 F7 zns_marquee.document.write(marqueecontent)
& f( ?1 B( }. r7 {9 Ens_marquee.document.close()4 l" w, p& A" O' \, U* B/ S! l: m
actualwidth=ns_marquee.document.width
0 v' p& e. Z% N}% ]: ]7 s2 U$ S" r+ N% v. t3 Z; Y
lefttime=setInterval("scrollmarquee()",20)
8 f  @0 V% H' s}; U& N9 s- I2 o# G% a: a1 D( t. G
window.onload=populate- U2 q  g# |: z

* U; {% w/ @) yfunction scrollmarquee(){
% k1 n: ]$ H7 d2 M' bif (iedom){
( N! ^; O, @' N$ vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 ~! w- o- @+ x) l/ e+ c/ E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! |* @3 @% U- Y$ q4 Uelse" V- ?7 p) D- |9 {% \2 T
cross_marquee.style.left=marqueewidth+8( B+ p1 I# t! ~2 w
& ]. e  k7 t5 y
}
1 V: D: [/ K* F; ], _* Uelse if (document.layers){
' H/ c4 A+ s' o; V1 Y1 uif (ns_marquee.left>(actualwidth*(-1)+8))2 U, k8 M: y2 q* \
ns_marquee.left-=copyspeed3 J3 u  I' R" R. x$ O; n2 d. R
else: X3 f" e9 \; t# X8 L, ]
ns_marquee.left=marqueewidth+88 K, {; F/ Y5 j6 x
}/ Y- I! K9 d2 s! G
}% p* ?7 H% V& S& t

6 ~+ l4 E6 F: H- Nif (iedom||document.layers){
% m4 i1 J  l) V( @" _; _9 Vwith (document){
1 _0 }* I8 ?# Z; p  D. _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 d* E# |. D, N% m1 j! Cif (iedom){
1 z* K9 w+ H) H& b- lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); H( L- Q' w1 ~4 C) G! R4 i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), {: j3 |7 ~" u* v- h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, \& `' Y( h- K3 b9 f  I1 X2 Q. \write('</div>')0 _" X# `6 M# t1 Z) K+ ~4 h: C
}& W( r* a7 r2 ^* O1 Z8 h
else if (document.layers){) _. y# v3 u: q9 J' X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 ]* Z: B5 r( r9 a, C( \& ~1 h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* g+ b% Z& ]4 e  Q- z
write('</ilayer>')6 j5 h) \5 D1 r/ u
}- l+ [' x0 w+ W3 E1 h. f6 y
document.write('</td></table>')$ W3 T0 N; m* Y+ @( F4 J2 E
}3 a8 N% M. L: Y
}0 H/ X4 e& @0 i8 m' h/ E4 E6 {
</script>

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