返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ y3 b# A2 ~8 L3 M4 A; V9 wvar marqueewidth=3002 H) ?4 t% V( D# x" A& U; o
//高度& F7 u2 y( v" }, d+ i
var marqueeheight=25) T; w3 G. w+ ]! u% ~  S7 K8 `  p
//速度(1-10)
, ^( E' |2 ~8 K! Q9 L8 mvar marqueespeed=3
' q2 `: D: [: F1 U. v1 i//背景颜色
% S' T1 z+ s* O0 P- R* \var marqueebgcolor="#FFFFFF"1 P1 a6 O$ |( t
//是否能暂停 (0=no. 1=yes)?9 O5 ^. o9 o  ^- b
var pauseit=16 F+ Q) _; V/ i6 S# _
2 H8 }7 {- Q. D1 T( G, O
//修改显示内容
1 e" T! e. x% I. r3 h. Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 I" P. M: h  E8 V

2 Q  \8 K, u$ ?$ \: t7 }. `% }5 Z& R6 P4 M. F
////下面不需改变////////////! I& g& r) [4 t1 h
0 l1 G" r) y% ^1 P: v6 X: ]. ~8 h
var copyspeed=marqueespeed' [" `/ U6 L& {; Q' k( z( A
var pausespeed=(pauseit==0)? copyspeed: 0
. x" h9 {, @5 _' Gvar iedom=document.all||document.getElementById8 K) V/ G" G/ M$ q6 _6 D* L
if (iedom)7 P6 q* g% N7 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 P9 K% `" i6 }" J8 [% e- Fvar actualwidth=''; j6 X2 }) G  O6 w4 [# b
var cross_marquee, ns_marquee" M: ^# q4 ^  I
4 H6 d9 V: P& Q5 C% C8 m# f
function populate(){4 g+ D' C3 v0 t2 I* N) X4 ^/ Z2 B
if (iedom){$ G, L* I' u! u4 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, Y- D$ R& F1 R* d: D  M- c( p
cross_marquee.style.left=marqueewidth+8
" Z' l' x/ j0 D, gcross_marquee.innerHTML=marqueecontent
3 ?4 @  R4 n; ?6 h( k0 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  b: A) Q0 m3 W; |) i3 m7 ?, p) L8 j}
5 w- [: m; i/ H1 t- ielse if (document.layers){6 q/ O9 l! O4 i; n: v* f3 o8 l
ns_marquee=document.ns_marquee.document.ns_marquee2
% v5 B! X) W( G9 O5 fns_marquee.left=marqueewidth+8
  y6 |) b7 Q3 J% y6 ons_marquee.document.write(marqueecontent)
; \* M6 T7 h1 w+ n6 a) {ns_marquee.document.close()
0 s- s; V2 R0 t: R  Q, g- uactualwidth=ns_marquee.document.width" l* I9 G+ T3 m  \
}+ h# `* g% v1 {# B1 V
lefttime=setInterval("scrollmarquee()",20)
  V+ h: a8 f. y5 x1 L; x}
+ Y9 v1 j  [2 owindow.onload=populate+ {( S' W" L  r( q
$ k% w! h! L- C3 ^' n' k  d/ M
function scrollmarquee(){6 N; J3 c5 w* r. H, W- p" `
if (iedom){( m4 W/ U" i) Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- n" L: S: _$ N1 H, |6 |6 T: ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 r% [9 O" K! Z0 b  Delse5 o- U% r& A/ B6 U) U1 \; G
cross_marquee.style.left=marqueewidth+8
& [4 C; S# W+ T: b
' j4 b( {2 _6 {1 S( }/ v( d" P}
) C9 {( h1 E+ \8 f- Melse if (document.layers){
, i" J( P1 i  G6 o7 [) }if (ns_marquee.left>(actualwidth*(-1)+8))
( |. P% t% }1 Xns_marquee.left-=copyspeed; R( W0 t8 I5 o" m
else2 q1 d4 _% D& S( ~6 o& t) X% P
ns_marquee.left=marqueewidth+8
, i8 z1 a+ B5 P/ @2 F}1 D1 q7 m$ n% E* u. e* k1 N
}
6 F& |0 X- F$ |/ l. J* J- f* j, I1 m' t' f& |& D; p8 Y
if (iedom||document.layers){
5 e" ]6 Y) t6 z* E) z& j4 C8 ^with (document){
) x9 A( o" Z8 s) cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" Q% P8 `- A5 ]0 f, N. u( E7 e
if (iedom){
3 q( |4 O6 f3 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" ^( d; i6 D- _) b4 ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 Z  v/ ~: s2 e: A7 N8 L9 X% vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 |, V) b+ i) d0 \: K, }+ ]% j0 g# gwrite('</div>')
* N4 G- R6 o9 Y+ z/ E}$ D' b" l5 q( M* M/ Z  n
else if (document.layers){" J2 `2 V3 c" _6 Y: U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* c. F2 h  S4 E! l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) E0 k4 w3 U9 ~write('</ilayer>')! u! g& m; W6 S, U* t7 C
}, G- @" _" G$ E- d1 [' \, \
document.write('</td></table>')
8 X8 G2 D: B* \. O6 g6 a  w6 ]# H; Q}  E1 u' X  ~" L2 f" A
}2 t9 j: _: A5 x0 _
</script>

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