返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 L0 e; m) _# T. l0 v: avar marqueewidth=300
3 p) P: |3 G; H% U$ j//高度
9 m, L7 X! `( |/ u' B) Jvar marqueeheight=25
- U3 p6 u5 Y" C# M9 Y, h//速度(1-10)# g7 @( n" r% f$ g
var marqueespeed=3% Y+ C1 q8 W  |. X5 N
//背景颜色. t( ?3 n+ m( i9 v5 W/ U9 V; E: s
var marqueebgcolor="#FFFFFF"  B- T9 @9 b- @( V# M
//是否能暂停 (0=no. 1=yes)?, @3 ^* b% |# d3 U
var pauseit=1
# f: f3 Y8 e& {% ~5 I( j) f% u# b+ s& p/ A! l
//修改显示内容
  N% y/ B* r: G" I. R; L* nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. f1 u  @& n7 h7 a" e

. M5 r- o( P7 d/ f1 ~+ u4 I
& t; X, r2 T0 `" o$ g- S" k////下面不需改变////////////
" d0 T3 K' X8 D
  @1 d# p- J! r- F" c# A7 Mvar copyspeed=marqueespeed
) C/ ~% _! }$ R% M% kvar pausespeed=(pauseit==0)? copyspeed: 0
5 l4 ?2 T5 @2 |( }2 Y- |! svar iedom=document.all||document.getElementById
8 H5 c* s# W. D2 G$ M# |/ wif (iedom)
3 X/ f6 Q: ~$ wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). R4 K( ~$ c0 w8 K6 s1 j3 v
var actualwidth=''" N/ N) u5 N! S- ]. t8 ?
var cross_marquee, ns_marquee9 i# l$ j, z9 o
2 |0 {/ u) r; F* B; u
function populate(){
3 {& G, G- k1 z6 kif (iedom){9 s* ?% P' O% ~7 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 o4 m8 A( S, T1 W
cross_marquee.style.left=marqueewidth+8
) t6 m! r$ G$ ^9 c6 e& across_marquee.innerHTML=marqueecontent1 r& i2 ~0 x8 G1 w  _+ B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  l6 B# s9 h# r7 `0 X, p2 U- X3 D6 X/ d
}
0 j8 c- m! y  s1 n* k' t* Xelse if (document.layers){% V) p) h0 I3 g5 b% k. D
ns_marquee=document.ns_marquee.document.ns_marquee2
+ Z8 o  W5 |8 V: I* q" rns_marquee.left=marqueewidth+8
$ N, z. {2 a4 S* t7 Ins_marquee.document.write(marqueecontent)
- s/ m$ W; H1 Y2 G. S7 Nns_marquee.document.close()! e/ e1 u: _) V1 a& r
actualwidth=ns_marquee.document.width
0 R: b" v! T! I" X}
+ b1 [$ o0 ~. F3 s% t0 K% Flefttime=setInterval("scrollmarquee()",20)
$ e( w, L* I& v. d}. O! q1 G6 N1 e0 e
window.onload=populate
5 F. |) ^* S* G, @% a4 f- [* [, {8 n- p
function scrollmarquee(){
# H4 K5 y( J% }1 o9 V& Bif (iedom){
: H' E: M) i! l4 W8 k$ m- Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 X& N$ \4 s4 I; x5 b3 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ K" ?/ J# R! p- B) Zelse
' p/ N. {$ q# ~% Z; ?* ]6 f/ Zcross_marquee.style.left=marqueewidth+8
6 i( `. `1 d( q! g6 Z! }4 u* w
+ s, e0 `4 q  q6 E8 M- V}
& v' G% p( }! _1 ?+ [else if (document.layers){
& {$ N9 W# n% q( i  ~if (ns_marquee.left>(actualwidth*(-1)+8))1 z" K7 o, @8 L7 n$ i1 f2 R
ns_marquee.left-=copyspeed
# K, A6 c! y4 P( pelse9 [5 [' j, r# S
ns_marquee.left=marqueewidth+8
1 Z7 @2 g- O2 I; N" G4 s, w7 a}
; U, F) d  q# _+ A" h* G# w}* w/ ~- O2 ~) I( g- v. g

: X+ X: _7 }- jif (iedom||document.layers){! ]# }7 X1 \7 \
with (document){
( t# S  ], Z1 p1 h0 X/ ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ l  y8 H, D* r+ e
if (iedom){
: K0 q$ T, i! J  v5 c% I4 q  ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). U% H$ K0 B3 N4 [0 B; k5 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( }8 t& e6 E4 O- F5 F/ Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! B- V1 n2 g" O# |+ fwrite('</div>')
" ]5 @' y1 [- j9 Q( ^( x}
: q0 e$ C5 n6 e2 G  F# z3 Y6 Y! {else if (document.layers){5 k/ n& e; v1 J. N: S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); N: b0 y/ a) l" s& b! f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# [9 n& s8 S* P5 Ywrite('</ilayer>')7 m5 h  B7 J& |) i1 l3 r
}( K% s5 e6 U4 Z) i  z' K2 D
document.write('</td></table>')
  N9 T: ]/ _2 I0 N4 t  ~0 [+ f( d}9 ]; N2 S* m! \" D% n9 s
}
$ {" [7 h2 C9 i  }</script>

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