  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度# L; i% y% ]2 S
var marqueewidth=300
; _/ k# `2 ` B! |1 k//高度 ?0 C$ B3 }6 v7 ]; u8 J1 _0 J
var marqueeheight=250 M3 B( A' B: ?( R
//速度(1-10)
0 C" T# L$ v" n% }; F, M0 zvar marqueespeed=3
7 [' \1 p D0 O* Z//背景颜色
4 K( j0 u( ~ p( Y& c. T7 M$ cvar marqueebgcolor="#FFFFFF"
1 l: R4 y# }" d0 h//是否能暂停 (0=no. 1=yes)?
( v6 M+ L7 N* I$ \" s, C( mvar pauseit=1
. K7 ~& o7 B) T: d/ v$ {1 ?- H6 b/ [) r: f2 w4 K. L/ E
//修改显示内容 c; |: o8 Y( X, T- ~; t0 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& A" C" c3 V+ e$ q2 e$ a6 ]8 D
9 N2 t- N% |; w/ G3 v X, Y' W9 c
' S( j- g' b9 D: B
////下面不需改变////////////1 h, J: T- S) [( W4 j6 Y1 ^9 I7 f" `
9 m& P9 y; Q) }! u2 w. Q
var copyspeed=marqueespeed1 K1 V# `* a, Q* E& @, @1 ]( z* d
var pausespeed=(pauseit==0)? copyspeed: 0
6 i4 e& E4 s" z6 H: [' Mvar iedom=document.all||document.getElementById
) b' r; x/ n% Nif (iedom)) h2 K5 j" x8 K; \& }) N5 H8 S0 n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, Q; z. H- N# x5 E7 e" evar actualwidth=''
! _7 ~! t8 M7 N9 `9 ]var cross_marquee, ns_marquee" k/ B" Z% A" i0 n+ V3 y$ `
2 H8 n7 v, n; H$ ^' J! {4 ffunction populate(){
) ^. n- b6 f# [/ B" J, Z5 R& u5 i& Jif (iedom){2 Z# d8 W& Y/ F1 l0 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 u' D) W' s1 r6 N+ w3 g) g
cross_marquee.style.left=marqueewidth+8, I2 p( r) r' J3 V( K8 M5 C
cross_marquee.innerHTML=marqueecontent P& V) M% f& W9 j. [1 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 {$ t5 E7 k+ I0 {: k. v; W( l6 ~
}
' b' o" H) p) g1 ]8 u( nelse if (document.layers){8 d* H3 k7 x, q8 L, e7 N
ns_marquee=document.ns_marquee.document.ns_marquee2: U) k; b1 t+ M' S
ns_marquee.left=marqueewidth+87 g7 k9 I9 C( Q& w
ns_marquee.document.write(marqueecontent) t. P: j9 G. A$ X3 C3 {6 s
ns_marquee.document.close()
$ d" ?+ m3 Z) w Q) D( h. h: ]# Aactualwidth=ns_marquee.document.width/ B7 B$ j, q q5 i6 X7 v
}
0 p7 Q( P8 E2 Mlefttime=setInterval("scrollmarquee()",20)
# t6 |# I7 q: k}6 \. w0 j3 Z6 P1 E
window.onload=populate! Q d! r# _% B$ ~) |7 ]# b
" a. E( x! j5 w% b: b, [3 `
function scrollmarquee(){0 S; Y* a5 n) w! @. |5 d6 P
if (iedom){! e7 _2 B8 @' `' W$ W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. O5 O% x2 E; `( [. p/ O* H( ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ C; z% \9 u2 M4 G# h8 qelse* A j% t" d& H4 b
cross_marquee.style.left=marqueewidth+89 i/ j2 S" o) d+ u$ y
3 i9 ~2 s& O* T- u8 ~1 U$ Y2 ~}
7 Y6 a! i7 a. c1 i2 @$ C$ D1 ~else if (document.layers){
$ w( F" q$ ?/ uif (ns_marquee.left>(actualwidth*(-1)+8))! t: j2 h2 m$ J5 g4 h
ns_marquee.left-=copyspeed
1 M* I v, s/ K) n: jelse
' B* T+ T* ?% B5 rns_marquee.left=marqueewidth+8
* f+ ~) {3 x" }/ ?& |}+ k; ~7 O6 I9 c
}2 S" W, c5 X% U
, |& d7 a3 f; I7 A+ M1 d9 b4 H
if (iedom||document.layers){1 ]3 n0 r* t. _" L3 E2 \& K
with (document){6 W9 p' V2 N8 P! B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! C& C' v+ Z: ^+ i( r0 R* y
if (iedom){
& L5 ~0 v( Q- r; q- z, r9 `6 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& o7 O: v( V% U- V6 W4 ^4 [6 T8 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 U: w& c, k1 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 b- Y, ?9 N9 Z0 H& a) n' U9 Cwrite('</div>')
: b) O/ x! ]' r0 O+ ]}( S0 F5 y) _0 [3 e/ S7 l
else if (document.layers){
$ ^6 Z% G" f; Y3 r* c. z/ h2 P. rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! [$ B( N3 E# s) Q4 m8 ]1 e* m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% B1 j5 y( j9 S" a& _) Gwrite('</ilayer>'): d* {# f5 G! U* ?1 z1 ]2 g" S1 M: \
}
3 r# E$ L& H Idocument.write('</td></table>')+ \( D: {8 R3 c2 H# z$ D
}
2 F8 l1 }. w5 n) @. @. m4 k! E% O}
' a, T9 a7 v: V/ n: W% X) N, x( Z! U</script> |
|