返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 n; C1 c: u% P' kvar marqueewidth=300
% c, g6 ~7 N6 f1 W/ M$ R" M//高度  ^& A. ~2 u+ N- p- g0 {" X* s
var marqueeheight=25
! B% R+ T; V; d( }* N7 x4 T//速度(1-10)5 L0 _& f8 C# A3 H; N1 `9 N, ~
var marqueespeed=3
8 t( J; x9 K/ A2 `9 }  @- F//背景颜色
4 Y/ J, X1 y/ e, Y9 v7 Z1 T& dvar marqueebgcolor="#FFFFFF"! B( Z% y' I) j" H6 y, N* {
//是否能暂停 (0=no. 1=yes)?
$ U. w2 Y2 [; D; v% B: }var pauseit=11 X0 @) G) Y4 w% R. t7 `
5 q& Q1 @& D! X% v
//修改显示内容
6 ?* W0 w# g8 h; o' ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; Q1 A5 F" s/ _  }% t/ M" A. u" u
0 M$ F( l4 \- m& d# l( k9 ]& [& p. L- N
////下面不需改变////////////
* F* K  |" Y# g) n, p
- Z- Y8 r" w% n: A% z7 v+ lvar copyspeed=marqueespeed
/ C2 l% m. q9 s: n% K0 U7 F/ Lvar pausespeed=(pauseit==0)? copyspeed: 07 [7 U3 _. y* w/ {- U- B
var iedom=document.all||document.getElementById7 l) X, ~% m3 p" o$ M6 b4 [( r
if (iedom)0 L3 Y+ F8 D2 n+ N+ R6 E9 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% X8 x# y5 r' M( u7 xvar actualwidth=''% V+ m% H* u4 ?+ ?, F
var cross_marquee, ns_marquee
+ `2 k* H- g2 X# N: a# |3 a
/ j* P1 t: B0 u7 [9 G) C( Efunction populate(){
) }. a  c# ^9 r- E3 L' \# |. Xif (iedom){
+ n/ \  ]" Z1 ?5 R5 Q" bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  J% |# c  r9 r$ N: y; e, a
cross_marquee.style.left=marqueewidth+8
9 v& t6 i7 N' k+ Jcross_marquee.innerHTML=marqueecontent8 u, x0 b2 \# z" b# ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& a. l3 Y6 L% L8 x& O  x8 n5 U. `3 ~}/ n7 i% ^) K/ s: M' I
else if (document.layers){
" T) t2 O! p9 B) ens_marquee=document.ns_marquee.document.ns_marquee22 D2 Y' R0 P* ~* m
ns_marquee.left=marqueewidth+8
  s, j, D$ `- [0 e  H( Dns_marquee.document.write(marqueecontent)0 m( e2 _! ^4 p& F% j, ^2 |
ns_marquee.document.close()
) D* f2 U" Q6 j- E7 ^/ j& ^actualwidth=ns_marquee.document.width+ J6 G+ Z* i: ^$ w. p4 F: K- i, [, {
}9 }0 w* K: y5 L  B
lefttime=setInterval("scrollmarquee()",20); P) b* c  H- n
}7 o( S2 e0 _1 M0 {& h
window.onload=populate: I0 H' Y8 v; m7 a3 e$ ^

( {5 n' U2 p' i# K9 U9 N3 yfunction scrollmarquee(){
& r3 q9 L8 ]1 ?( A) [if (iedom){
3 X0 M/ B0 |2 d# Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 a, z. D6 }7 t! W4 h: T9 ~' i# h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 @' j# [; A' u: L' Jelse
- B5 i) P8 E/ M- b' u" Vcross_marquee.style.left=marqueewidth+83 H7 \6 ?2 V4 n! v) r* M: D/ j
4 [* V1 {8 u& i
}
/ v! b, @7 O% c8 S. L1 p8 W+ Xelse if (document.layers){
) T4 m. }( L, t' H2 bif (ns_marquee.left>(actualwidth*(-1)+8))8 D, r3 b8 e+ j: r8 ~
ns_marquee.left-=copyspeed
( _. ^6 I3 g' v9 d& telse+ n9 v, i1 b$ K8 `$ H5 M+ M$ A
ns_marquee.left=marqueewidth+8" H7 d5 F) V$ \
}
: I6 E9 P8 ]1 I5 G; M' H# f}& J* Q* H7 U: g' `- _% o0 H6 S1 n+ r( l

& X1 s- A# P4 g& A8 E- i( U  Jif (iedom||document.layers){  x' w/ c0 r: _5 Y3 B1 m. c
with (document){
, G% P, Y0 N: v3 \3 ~) s; ^* qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# W" G# w3 m% Q" `. N0 F  [if (iedom){
1 G" g& e9 |/ V* m4 A' A7 o( ^# Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# K" m6 d8 W' A$ |( Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) d% i2 [. w$ ~; H& ?( K5 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- e) ]& }1 L! S4 I* Jwrite('</div>')( G& Y  H9 F4 n1 M; U  v
}
& Z6 L2 A- z! Qelse if (document.layers){" H" l* q' o  `2 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ n% D6 o8 `. C( J" O& wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% Q3 h' S- ~2 ^& `: Q& L$ g* t0 N
write('</ilayer>')
7 ^/ `+ n# \3 E% Z/ A}4 e3 [6 I0 W* m+ }+ e0 U* J
document.write('</td></table>')
: r6 L/ e( }( G' K1 I1 D}
; w. Q  E% s5 N}3 n! l3 _7 _5 ]* K/ \
</script>

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