返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' t' A* B  {5 f* Y6 J  Uvar marqueewidth=300( M0 H4 P2 n2 m' v! t
//高度
6 o* G+ m" W( N( q( a! t, Tvar marqueeheight=25
7 C0 S' S$ }: B- r: o( @5 g//速度(1-10)
. K9 j7 w' g* \# V5 g1 m1 i; {var marqueespeed=38 f) y4 D, ]( B3 j" @
//背景颜色+ j; j1 X5 k5 v/ r
var marqueebgcolor="#FFFFFF"2 ^6 h% ?  _5 J
//是否能暂停 (0=no. 1=yes)?" Z; c  Y" |$ u( U+ Z/ S  k8 S
var pauseit=1: R7 A1 X) m  @5 X
' Q( {* _  u0 D
//修改显示内容
, t2 _1 A3 [) A# Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 C& K  z5 Q) X( r4 F) p
$ i1 g8 `) q% r% |6 C9 ?8 c0 D7 R+ C# C/ r3 U, O8 B% S
////下面不需改变////////////
% ?8 k- d. }4 |8 b
% h* q7 j8 ?9 Rvar copyspeed=marqueespeed" X1 t+ v4 c6 `  c  E0 h/ k  |
var pausespeed=(pauseit==0)? copyspeed: 0( V- X/ |8 E; c" u  i
var iedom=document.all||document.getElementById
: b8 y4 L* K( B! c) zif (iedom)! ~- N9 t3 s; W& @3 @; F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* a0 i. [* c5 |( s% s+ j9 s- E5 X
var actualwidth=''/ w2 F: r0 Q- X8 ~1 z6 m0 G# W. ~& U
var cross_marquee, ns_marquee
3 x/ s& T$ y4 A0 y3 c( A' U1 s, p5 G
, O* p  G+ k' I7 X, qfunction populate(){
- d3 g" `* F  t. Sif (iedom){
. ?9 B2 ?( U% ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& L4 z8 l6 a) k. ocross_marquee.style.left=marqueewidth+8; y# t" E  b+ n  V4 {- x  D
cross_marquee.innerHTML=marqueecontent
5 v0 {9 n: b% d+ G' K! e4 q: Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ d' d2 W2 G7 I  g" L2 F" d( [* ]! D
}/ Z) n; U) V3 @0 M7 J, F
else if (document.layers){/ u% p3 A$ U" q- U' {
ns_marquee=document.ns_marquee.document.ns_marquee2+ S2 N" f: A8 l& M$ V
ns_marquee.left=marqueewidth+8
9 |, T, X2 F1 ans_marquee.document.write(marqueecontent)
% d# [0 C/ g4 D* |2 q' l4 R; h% O: R+ gns_marquee.document.close()1 K. Y9 K4 q0 V, ]# B9 c
actualwidth=ns_marquee.document.width  @7 I; |  a- f) R/ c' A# \9 r. i
}2 n1 x1 P' [! |0 [5 g" U
lefttime=setInterval("scrollmarquee()",20)7 E! i& |0 \/ R, O
}/ k) r3 D9 }' i1 ~4 v" \3 v
window.onload=populate. O- N0 Q$ O; Y9 u$ Y# c+ c

+ R* u; s" a! O) Jfunction scrollmarquee(){
% |! ^# ^5 r; E' W/ b2 Kif (iedom){
5 g0 a% M, M% \1 j  c" i6 r' Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  N9 P0 r& c9 o. y2 n5 U1 E! T2 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: d6 S1 K# ~5 x* _% b( B; S9 n/ qelse* y0 x2 O% m+ d* Z6 s5 `8 h
cross_marquee.style.left=marqueewidth+8' m' T3 k! a+ @* X& L1 e% w+ k

7 P/ M: v+ r9 F2 {& R" _; k}; d0 S; q6 E! W% Z$ _
else if (document.layers){
3 A4 B' }) G1 g1 s; B7 aif (ns_marquee.left>(actualwidth*(-1)+8))
( k; S5 I2 B. ~& D* Z0 a1 B& b) c8 x3 Gns_marquee.left-=copyspeed! T  Q+ Q$ x% U5 Y; A/ r& A5 Z6 p
else
8 O  h  l- }7 @& R  uns_marquee.left=marqueewidth+8
6 ^2 [& t* ^' c}
* P9 \( ^/ n/ G}& C$ N! E: D3 ?) f6 `
( ~. A2 g6 i6 n
if (iedom||document.layers){/ B7 b" I$ a( v$ ~  h
with (document){, d, |. e- Z: r3 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 m4 b2 @+ [5 E6 c" z3 {
if (iedom){7 ^8 N% |7 m7 ^7 U  n0 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 p* _# s+ E9 \8 H, i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 J% `8 t8 a! e$ ~. Q1 ]  v: ~) _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( B; P. l! O* D4 u" u2 X4 ~5 C% p( vwrite('</div>')) N' k4 H  N' V* z
}/ b- h3 w* P7 \
else if (document.layers){
: ?0 i2 f  A( A6 K9 H; f( c: cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- j! U  E' E4 ^4 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! c" {' N$ t. a
write('</ilayer>')
0 S7 [, G& x5 _  ?# ^9 N}& h% ~1 x' M. A  j- a
document.write('</td></table>')9 _1 y. o$ P+ u9 e
}
7 F  ]6 A( m+ Q6 z}; y' T0 q6 ?0 ^/ x
</script>

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