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

|
网页之跑马灯文字特效
//修改宽度5 s( b2 S$ ^3 p8 f# s
var marqueewidth=300
3 V: J) ?, H$ V+ ^, h% w//高度
8 f7 X6 s, k5 _ ^! C& c3 x0 Lvar marqueeheight=25
3 t% a, [7 l9 ~) u) W0 T- f0 e//速度(1-10)% ^/ C/ n* v: w( p* M
var marqueespeed=3
6 u' z. W) C. K$ z//背景颜色
% N2 V; M# z* N! b% }var marqueebgcolor="#FFFFFF"
) o: c( ~+ y* ]" x5 o ]3 ~9 h//是否能暂停 (0=no. 1=yes)?) D+ {9 b! i2 r2 K6 U2 U4 E$ n
var pauseit=1& j# n4 m' d1 m$ o8 G: L/ @- H
9 a+ i, N$ R: D* h' L+ A//修改显示内容
. L/ c$ p. V p! U- T9 Z7 d2 lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 |$ Q- E8 P9 k! Y* j* L
, [( e7 m1 ?; q0 B& {, a4 r& J7 g, p6 x( t+ \
////下面不需改变////////////
' K8 |; C8 q5 D& A0 `/ l: F( W# @9 p s$ F' _7 k/ u
var copyspeed=marqueespeed
. Z' D6 h) |$ |1 y, I+ a% _% U+ O! pvar pausespeed=(pauseit==0)? copyspeed: 0
5 o. i7 s# b2 k( h# w: m' Pvar iedom=document.all||document.getElementById C/ l9 C; ]* q: G
if (iedom)! {5 b3 R) z8 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 S! f9 ^' e" m* {4 z" V! Rvar actualwidth=''
$ N( w* N. C1 z8 Evar cross_marquee, ns_marquee3 M( N3 m. Q8 B+ ^# Z
4 q$ `- l7 d# A) w1 I) ?" P
function populate(){
: A. z8 A& W' P) g/ jif (iedom){4 J8 E; k# x3 P) s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 m6 s2 W: `6 \" X3 c: c% a5 @
cross_marquee.style.left=marqueewidth+8
# i: P5 j/ z( K8 O$ ycross_marquee.innerHTML=marqueecontent# Q0 s) s. W0 x" j9 O( F+ p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 L1 Y* N/ O! J0 z% t. O: W}# P2 Z! Q ^% F+ V; F; K) u) j1 t
else if (document.layers){
6 ?1 G. i. `. ?9 h* e0 v$ O9 |ns_marquee=document.ns_marquee.document.ns_marquee26 y' V/ }6 L8 j
ns_marquee.left=marqueewidth+82 `1 f& S, k5 F0 d! H4 `
ns_marquee.document.write(marqueecontent) m* @9 C0 _' F S( Z o
ns_marquee.document.close()
: o B' M$ ~' ]* o' P( G1 y5 e9 vactualwidth=ns_marquee.document.width
3 T6 w# G; j8 j4 ]}% S, L5 b$ |8 M
lefttime=setInterval("scrollmarquee()",20)0 B, S, s0 f; ?4 ~
}
2 I% e2 \* F( G$ ewindow.onload=populate
% f- V# V" J% H$ o5 |1 \$ q. w. n: E' |: C1 F
function scrollmarquee(){
; X, `# p$ G3 C0 Lif (iedom){" T6 _4 t4 }6 A- j/ c& n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 d5 V; G9 K, y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 S& s, \9 K0 r1 r7 zelse
4 W( R: }; x$ o+ Scross_marquee.style.left=marqueewidth+86 j8 Q2 K5 N1 r5 Z) s" ~' f
9 g# |' F/ q& Z3 [) h$ ?}
0 R* \0 u. q ]0 q# x7 l9 d2 V- Gelse if (document.layers){0 p2 E8 C) [) H$ G# C
if (ns_marquee.left>(actualwidth*(-1)+8))# F0 d2 g" k! c8 O% u% K8 `
ns_marquee.left-=copyspeed
& z: E7 w' \2 r# q, S1 Relse- ~! h+ H( `$ I! w5 [
ns_marquee.left=marqueewidth+8
* X T! m" [, k8 K" \' ^' F2 i: y}
% A4 `+ J! B, l% O}
& V% C: s) h1 o r! d. ^: _, [) d8 X) o$ B( [8 j
if (iedom||document.layers){
: W; e* a! A5 a6 e/ \% r4 {with (document){6 k8 ~( N u7 F; y$ M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ d2 j8 v \ T$ S, a
if (iedom){8 `9 {: t1 ]) W" @: F1 p% Z- D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 s6 {2 {) t1 ~, lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- N9 Z" t: G8 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 a# {' j8 ], mwrite('</div>')
1 q8 z. H5 ]) b0 S1 B. D0 t}6 P) }0 u+ X. r4 j
else if (document.layers){
0 X; h& _& |0 s, c# zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ X9 p( Q0 l; n5 V y! g# Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ k: K+ x: p' m) F8 A
write('</ilayer>')1 s0 |# e3 E W( \/ j( l+ L
}1 K4 O3 a3 c% ]! J( a$ A( D" x' b
document.write('</td></table>')
0 ^. X5 Y- @$ l}
- ^5 L# P* N% j1 P}
9 G4 S) v8 V# a2 C8 P' M</script> |
|