返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ h" _2 Y: |4 O+ r! _& x/ n
var marqueewidth=300
# R/ [4 P+ N! o. B//高度% D+ z/ R/ F( I' L
var marqueeheight=25
; \/ j8 v( v1 s& k* z. t) J//速度(1-10)) L5 h$ F2 M* k) d3 ?  a/ C9 a
var marqueespeed=3
! }8 I& \# }" m9 @- _//背景颜色$ `, q% ]& C; J$ g* }7 E, o. {
var marqueebgcolor="#FFFFFF"1 T# V' h6 ~2 |! U% P  Q: k
//是否能暂停 (0=no. 1=yes)?' T9 {& L4 z; j+ z2 J2 M+ s& e2 l# o
var pauseit=1
# e& ], q6 q1 V2 h3 H
; l8 J* d: c: p) w//修改显示内容7 V2 q) g" J9 h, W- Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 |0 ?9 H! L" ]9 k! q& j+ Q; U; g& j" r7 J; X% x, [

4 r" d3 Y% j& W/ i! e////下面不需改变////////////5 O& l6 j4 S- U" F
* `+ P) |' J  K2 Z3 j1 D) `
var copyspeed=marqueespeed
! Q3 F5 @' U1 E: U& }var pausespeed=(pauseit==0)? copyspeed: 0
& y9 ^+ }* t9 i$ n& R. @" B5 Xvar iedom=document.all||document.getElementById/ {/ N; X5 N( U' ~+ P
if (iedom)0 }3 v) Q" C0 P% C. d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" \4 p" n* c/ l! E1 r
var actualwidth=''
0 v% [1 G2 l6 X$ a3 b" L- Xvar cross_marquee, ns_marquee/ O; E' i! q9 ]3 i
! V9 H" }1 B1 K" o0 P6 S
function populate(){
3 N* w% v8 T8 \if (iedom){: Y* r5 |% E. l6 O" j' o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- t6 b/ L! A7 `$ e
cross_marquee.style.left=marqueewidth+8
6 @7 I: B3 f8 ?) E) _+ Ecross_marquee.innerHTML=marqueecontent+ T5 B9 D, ?. m. L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; z& {/ G5 X- p4 W' p  l
}: g: ^: m6 g1 t
else if (document.layers){
4 Z1 c: \: x" E1 ~ns_marquee=document.ns_marquee.document.ns_marquee23 t- D; `0 u2 I5 [/ S1 V
ns_marquee.left=marqueewidth+8
6 B$ }0 h" B. v8 Q4 R& Dns_marquee.document.write(marqueecontent)  {" w" O, g$ Y1 U4 X5 F
ns_marquee.document.close()
- |8 P# j, [% I6 @& ^% Tactualwidth=ns_marquee.document.width
$ g% W% {; K) w2 \3 \}4 j8 m3 o& s1 U0 M7 v, f
lefttime=setInterval("scrollmarquee()",20)
7 y, x7 S! E0 o5 u}
( r4 h9 n4 U2 e* awindow.onload=populate  S& a0 V# a5 z5 y

$ Z  }0 b3 j6 u1 w" Wfunction scrollmarquee(){
, R1 p5 o2 d0 X' ?if (iedom){, `4 K/ v6 b, u, Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" D5 k, E# O. h3 c5 X4 [3 B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" F6 ~4 ^* _' Z: Q9 ]% M* @else! D  m! D/ W, |- c. }
cross_marquee.style.left=marqueewidth+8. v, B" U1 E/ }9 B
8 ]9 k0 r; I: B  G2 h% R
}/ M$ N: c; J' t0 J9 k
else if (document.layers){" J( j5 C: d* b1 R
if (ns_marquee.left>(actualwidth*(-1)+8))
7 Z( @+ M+ n" k/ U7 w) D/ F' f, Vns_marquee.left-=copyspeed
1 J9 k" i( E8 k& t* ?0 N9 melse$ s* V' n0 J7 I# P, R; }
ns_marquee.left=marqueewidth+8
, |6 [7 w4 _0 j1 [}% u2 P9 E5 G: Z! N7 S6 L
}3 b* a' l5 n6 I6 S* Y0 X! I9 e' o

, w/ f6 C7 g& r' V7 Y$ m1 [  bif (iedom||document.layers){
7 k: L3 A- l: m' z% M5 N& Qwith (document){" S* D2 e+ P3 J  P- M1 A/ d; u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% z- o/ Y! x3 n9 I7 |1 X& \9 f
if (iedom){
9 U# V  a' {7 [6 W2 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 C+ D; s- g9 m( A3 [; Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  p1 O* u$ M. m0 F' J6 `' k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Q4 [# [/ m9 f' m' Gwrite('</div>')" W0 w. n7 _2 N* I7 O
}5 H0 l0 V. [( v/ M% I
else if (document.layers){
0 x4 w$ W4 j7 b0 U' z; j1 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! T! B8 i. r2 |, y- K4 U6 u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ I0 _4 ]4 L1 S. f; O+ awrite('</ilayer>')
4 L& c0 L+ P3 `  p# _- y$ F( G}+ f6 _. j7 ~& M6 i* V1 Q( M  J, B
document.write('</td></table>')
5 f. ~2 P5 P3 Q7 z0 o! `8 _* L: a}
& c; e% o; N& |& B: J1 T}
. j+ z: H1 k+ V7 ]</script>

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