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

|
网页之跑马灯文字特效
//修改宽度9 P* j, {- r. i. ~3 x- G
var marqueewidth=300# S3 j$ g$ p7 Y
//高度: z7 J2 j8 _7 `/ t) S7 O' Y" x* Q
var marqueeheight=25
6 u! S% d1 J, ?) w, o$ A J//速度(1-10)( V9 X" H5 h, g* H
var marqueespeed=3
) _8 r# U7 d3 v5 T//背景颜色: }9 H0 f* H: m
var marqueebgcolor="#FFFFFF"
* } |" Y# ?( v. j//是否能暂停 (0=no. 1=yes)?7 o# C5 ^ x x" s3 ?9 U4 C1 w; A6 {
var pauseit=1
) U' l% `: Y6 p6 g* s) D2 B6 n, x& ], D
//修改显示内容& [3 ]7 K) K5 j1 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ u) z+ ]4 L! Q: W
$ M5 X @9 ]8 S4 h1 \% v7 k: n/ a; n' b3 }: m' K
////下面不需改变////////////! s7 @+ l3 c/ Q! |
2 K& i2 T6 f- R9 V0 I; G
var copyspeed=marqueespeed Z' Z. N& H$ I/ a J
var pausespeed=(pauseit==0)? copyspeed: 0
: n6 _# }8 b! v9 o Bvar iedom=document.all||document.getElementById9 G# r. T' p0 p: v9 H) u. [
if (iedom)
' T+ Q+ }) x: U$ @1 n8 `8 [( gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 k @, F. s" X7 f; k, T
var actualwidth=''9 w1 K4 Q5 T, M
var cross_marquee, ns_marquee
& p1 o' J! Z' ^
5 i& h) z2 `1 ?9 }! V Ufunction populate(){: d z$ R; Q! f7 j& j/ T" q
if (iedom){
8 A$ p# x, h- E' x( z9 A, gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 g J0 [; V, F( ^5 `9 Z- Ncross_marquee.style.left=marqueewidth+8
7 y2 [( K4 @6 \0 d* Vcross_marquee.innerHTML=marqueecontent+ j$ k' }! K' c& t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ W% @( b+ B! C# Y
}+ i7 Y" r7 a3 W* n* ~! @' g6 a
else if (document.layers){
# U- |# ~3 j: f# `: H( L( Ans_marquee=document.ns_marquee.document.ns_marquee2! y0 j) H+ f# V T
ns_marquee.left=marqueewidth+83 a0 m6 d. s9 x! l9 e9 {6 u# N
ns_marquee.document.write(marqueecontent)
# x. B0 f6 q: n+ O4 t! O2 \ns_marquee.document.close(), Z0 u" J! g5 @# S5 ^5 z0 O
actualwidth=ns_marquee.document.width% u2 f- N) J* N) A: e6 H6 U0 v
}4 t4 E" U! w- X4 s! F( H) Q$ ?
lefttime=setInterval("scrollmarquee()",20)
- \5 q) F9 H4 l3 `9 l" K' q% p% z}
4 B" J% {: |8 T; w: R, Wwindow.onload=populate% p: z* c6 B# t2 P
/ Y9 `8 I( k$ E- ]" F4 p
function scrollmarquee(){
2 a. k3 p% f0 V6 ?if (iedom){5 k: h% s* s" B# E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) m- L, Z/ _4 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 Y# u+ w& ]- Q) _& R8 {
else# Q" j, L4 j. Y) S" S
cross_marquee.style.left=marqueewidth+8' J/ r* ~+ {) r0 P: R; O
1 e" G4 M; c4 H* _* K}9 W! d3 _, C, y
else if (document.layers){! N! u: l# d! H8 l
if (ns_marquee.left>(actualwidth*(-1)+8))* z2 E- V; z- z9 p2 Q) E2 t
ns_marquee.left-=copyspeed
, {, |$ H& o' X5 f5 K3 |& Telse; t; z* X; G* u, @
ns_marquee.left=marqueewidth+8% K3 ~& E4 y! ]3 ^' X0 a9 P
}- B% S) y1 S9 q$ O2 a
}
2 ^. G' W( S2 t
, x! G' N; \8 V& fif (iedom||document.layers){
9 F0 X" F' I, @. _$ Zwith (document){
2 U/ N$ d0 T+ s- R: K& xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 B& Z* l# _, _ C5 v8 c5 f: [$ `
if (iedom){
! ~) J" I; B j1 z: N- E. nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 C' C6 i% G/ J' a1 Q! Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 P8 B- U/ e- \% z1 K6 k$ S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
~4 X8 O6 x8 F$ S4 p w) |write('</div>')* |$ s4 N' i( ]6 Y7 U
}
" w4 U% J! j R, `" Xelse if (document.layers){
# N* W$ @, m2 P4 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" [3 k* Z U! K, Y4 [' |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) k6 T+ ]$ ]( K0 z6 d* E
write('</ilayer>')5 J) i5 a, \' Q
}
& Z8 V3 O! U. a idocument.write('</td></table>')
) T w" W; }. G+ i3 j( }}4 N' l' o9 D4 ?9 N0 z* H
}
1 y8 w' W, F7 K# L</script> |
|