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

|
网页之跑马灯文字特效
//修改宽度5 K' z4 H2 l. \8 N( S7 S
var marqueewidth=300) M+ }0 o5 p- j$ W$ a
//高度% ]$ c- M' X6 ]* l! C4 T* M3 O
var marqueeheight=25
) p: O% d% G$ d8 U//速度(1-10)
5 K; q' V1 b+ [" \$ Gvar marqueespeed=3" ]0 K" @1 x& R) [+ n# ^, ]; y
//背景颜色
& M j0 }6 R6 O b( k5 ovar marqueebgcolor="#FFFFFF"
7 c1 V9 x1 Y# q; U: H+ K; k( V: {% e5 I//是否能暂停 (0=no. 1=yes)?
^* q/ f# A0 L( s. H, Nvar pauseit=17 h: `& _! P# j1 c+ z/ W
) ]6 x" k+ c$ r" {1 q0 r//修改显示内容
% r O' f' y7 Q: P( Z4 N! Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 d# M5 i$ z' J! ^
) P9 g" ]9 k. a0 A; A' ~. A) R& X, _1 |+ _6 i8 U1 P5 H
////下面不需改变////////////
. f8 w+ S# L1 O( ^1 v+ g! M
) k! Q$ V* O( A$ Q0 h: yvar copyspeed=marqueespeed
& z4 V, Z" E& }" [2 t; n# ~# ^- o& p" ]var pausespeed=(pauseit==0)? copyspeed: 0
4 A! T& o! K% b/ C1 J! s8 Kvar iedom=document.all||document.getElementById
( d* ~- z1 t9 f. T+ G1 E5 Y* X3 Z4 aif (iedom)2 H! C* T8 l: s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! b" f! t, V9 g1 c% m
var actualwidth=''
# c2 ^5 ^, |% U4 ^7 }var cross_marquee, ns_marquee. q8 w/ x& }2 ?( K
Y8 X% a% ?: |$ U4 \$ c$ t yfunction populate(){
" G9 a. i# x. x* f- N# iif (iedom){; {" q1 h" H( y [! P+ a0 K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ E8 `7 D$ R) k. k) _* ]
cross_marquee.style.left=marqueewidth+8
! N3 J& H* H" m! L4 f2 z4 jcross_marquee.innerHTML=marqueecontent
+ D' ]2 U1 n9 ? jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 G6 h4 X& z9 v}! Y' L! c' L0 ]! ^$ n* z1 b
else if (document.layers){
6 i; N% A- p0 ^; Z+ g! mns_marquee=document.ns_marquee.document.ns_marquee2( u1 \. U/ E/ F* Y
ns_marquee.left=marqueewidth+8( }# C5 y+ J& r) C# _7 I
ns_marquee.document.write(marqueecontent): k6 k. H# d/ K8 y1 Y( \ Y
ns_marquee.document.close()
1 r9 r' P/ Y: Mactualwidth=ns_marquee.document.width
9 k8 r7 X( Q) Q2 x2 R; X+ l2 E}" G% m! B! a% y: b0 G2 s/ W
lefttime=setInterval("scrollmarquee()",20)- `$ r/ s5 F' P% z. @ G# u2 x8 R
}
4 H5 f0 o; s; swindow.onload=populate& f+ O' u' }- K$ G4 m3 b& K, q+ D
: Y5 q& ~% @# x5 E2 ^- |function scrollmarquee(){2 j0 j7 E' k: h6 u# `& z
if (iedom){
& s% O8 }) {+ u- a/ I+ }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' J4 ^" E6 m- S1 d/ H' Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ P' ] X; J |
else i9 Y+ G4 @" D# E
cross_marquee.style.left=marqueewidth+8' I4 h2 T4 y0 Z) Z, v. d8 Q
& o& z, I4 Z4 Q9 M; L. {7 F
}5 a f X0 f- I- ]" N
else if (document.layers){) Z+ n- h9 }9 X7 E+ H' [
if (ns_marquee.left>(actualwidth*(-1)+8))# ~1 I* S1 P7 l7 R- r
ns_marquee.left-=copyspeed" y' ?' }/ @7 E ~! q2 w6 L$ I
else* T1 T9 r9 O. M4 [ v; d! d
ns_marquee.left=marqueewidth+8; n' y0 N$ F7 _
}
" z! m3 _+ h9 t: }9 d q}
6 s# t# q$ V/ e# V
) d2 A; Z% ^# z: _if (iedom||document.layers){
/ I# D1 Y7 ]+ N% [with (document){, B# s8 K5 B7 R0 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') U5 O9 O' H% K2 j# O4 t
if (iedom){: b7 G/ g- D# X- R8 C0 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* h' A" ~& V( ]- I$ i/ k& c. Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* a! [' z: i) O) W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! T7 P# x4 u$ g2 t2 Q B
write('</div>')
9 E$ m9 c% i1 U- f2 P8 q2 q}# L* Z" O0 @" R/ I5 u
else if (document.layers){- T) a% o- }; { S" E& N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' S% V# w. y2 H7 {7 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) D9 j& e- \" p0 t* W3 cwrite('</ilayer>')
) G# B- b2 O8 W. h! B0 `8 j" y}
; B4 f3 D* T1 o7 v* z6 l: edocument.write('</td></table>')/ n% O: v& P7 [0 i# D
}3 X; s: }1 c; z1 C
}
. X; L! h, _0 y9 p `</script> |
|