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

|
网页之跑马灯文字特效
//修改宽度+ d; k8 x2 H+ ? m. E) d
var marqueewidth=300
$ w3 {8 L2 [. f) _6 I) @6 v//高度
7 z! t" s6 |% Q& W8 Y j8 a+ ]* tvar marqueeheight=25% Z0 ^8 W8 M& w2 p' F2 L7 x9 j
//速度(1-10)
5 [5 ~& f& z |var marqueespeed=3* B# I6 `9 s. M+ g% i# Y: b) P% v
//背景颜色
' q3 _0 s- `) ^% Y0 V, \6 b0 y- vvar marqueebgcolor="#FFFFFF"% u9 e6 V/ q Z
//是否能暂停 (0=no. 1=yes)?6 ]) E9 o& N( _: @* a' R
var pauseit=1
+ ?& e& l, ]! F; R) a8 B
- n' N4 S" r6 o8 w. v; D//修改显示内容
' f' o3 j* p1 X* F3 h* G( N: \! A5 Q, qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" v) L% ~$ U8 l& [1 L
! z5 ?( V1 _6 y4 Y2 j9 y$ F3 N1 D% l' W5 f
////下面不需改变////////////- Z& e$ [, g: g& v2 W6 E) r. f, W& H
2 H: B2 W$ c4 i- Z Pvar copyspeed=marqueespeed5 T5 {7 }6 g" F+ x% X, m
var pausespeed=(pauseit==0)? copyspeed: 05 |) o5 \; r; W" m- F3 q- z
var iedom=document.all||document.getElementById2 ~5 I* ]/ m2 b
if (iedom)
& Y' f+ M7 [) g# Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" U6 C# U; H& v9 hvar actualwidth=''
( P; }0 r6 i8 v+ o6 c% Svar cross_marquee, ns_marquee
! p' j2 H* u' ]. d9 p( l/ f8 |* |( r# d) z6 F: n
function populate(){
( M# S, s+ y1 y: J3 }5 jif (iedom){+ u Z. H2 {9 y4 I5 s; q4 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 K/ E7 h% i* o" X
cross_marquee.style.left=marqueewidth+84 a$ B- a# t& f$ W" M4 m
cross_marquee.innerHTML=marqueecontent
" L; r% P( w. w3 G$ b; e {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth X1 Y, N3 a" z! B$ ~- @: x$ T
}
- F7 I' o# s+ v! X4 u( Belse if (document.layers){1 S& ?# @( V4 {3 n0 Q
ns_marquee=document.ns_marquee.document.ns_marquee20 M" K. u& o. g1 @- V, ^' {# E V
ns_marquee.left=marqueewidth+81 I" B& h2 }* g2 u: s' |
ns_marquee.document.write(marqueecontent)
9 t+ g* Q# Y3 y4 Y1 \ns_marquee.document.close()+ ]4 T( M4 G# A: h- L% b( F
actualwidth=ns_marquee.document.width
6 P0 a3 ]2 w c& t}
; h. Y$ _$ y! H slefttime=setInterval("scrollmarquee()",20), N9 W2 d/ J2 G! c' n
}; [9 G2 I- N0 ?4 r5 v
window.onload=populate; [% m8 T/ _% ]1 E
. F! A, r' M$ n: v% Ffunction scrollmarquee(){* O, x( h! r( }: J2 V
if (iedom){
2 Y+ A& Q. z7 Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) W( |' k i$ q6 g8 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& T5 y- b# P; k2 {% z& j2 telse+ ~/ X' W; [& ?2 l0 R+ @; m
cross_marquee.style.left=marqueewidth+8
$ A; Q( T4 X2 n: D7 ?5 [/ Q/ n5 i" w" i' Q* o
}
% M1 y" j! Z8 b4 welse if (document.layers){
% o1 w V4 W' d+ B& [+ } L6 L% kif (ns_marquee.left>(actualwidth*(-1)+8)). w. Z9 G" @- U d" K
ns_marquee.left-=copyspeed7 g" f1 i% e- F; {/ X* [; f
else
0 [9 E: p4 ~: v3 dns_marquee.left=marqueewidth+8
% t2 v: T1 A8 x: r+ U4 ^# P Z5 @}5 l6 S6 H" G; }- r
}! _: n! L0 E1 E8 d7 R% C/ g
# x2 \/ ?% m, W B! S
if (iedom||document.layers){
/ B8 Z1 _& w. O5 Zwith (document){
& |5 {; P6 U9 X: U/ cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* A W* ^# @0 U2 x6 z( xif (iedom){+ h) S8 o' W! l9 F7 o9 [5 F' V5 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 U/ {" V8 z3 Y% A( Y# z8 Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" u5 N @2 Z/ G: J& C* ~3 \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- T7 r( u% J0 U W* dwrite('</div>'): |) X" k2 I8 d6 H5 Y1 A. Q
}# L1 K& z. s' Q+ a- K. p* b; ^
else if (document.layers){
/ w/ E! m) J" c$ Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' H! ~1 H, y. N5 F3 N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) h, t1 f3 r% Q+ U, ?4 P% f
write('</ilayer>')4 q) m/ g6 ]- G' A# x! z3 Y, T
}7 m7 K0 b7 @. B
document.write('</td></table>')
0 Z) {# r% f d- y- M( r6 W7 H}* T* k4 M! Y0 c; q, q
}
k5 B! C; M( w) D</script> |
|