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

|
网页之跑马灯文字特效
//修改宽度) C! m; m" U; p( F7 ~! Y/ J
var marqueewidth=3006 n! s9 E4 v% z4 u3 e
//高度
: k" E- W% M9 m' y. @var marqueeheight=25
, _: ?: f& h* n/ H9 H//速度(1-10)
9 ]% j: Y6 }6 M8 f3 Vvar marqueespeed=3
% B$ k* m" z# [//背景颜色
/ {; P( q9 @8 K- Mvar marqueebgcolor="#FFFFFF"
. O& }6 }& G o! K3 h) g: F//是否能暂停 (0=no. 1=yes)?4 c7 c2 x( ?0 R* Y2 j) W) |- m+ ?( O
var pauseit=1( E7 z* p8 X- ?+ o
( d Y1 Y8 r9 _- O: o9 v& b" V9 s
//修改显示内容
0 H1 e$ L% a* O9 s# m) b$ vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 F4 }8 u6 W5 v# A; C- y) K5 x s4 {, K+ L. Z& {& n* H+ M; G
: D% x" ?' `3 p+ M////下面不需改变////////////
D; `7 m0 V) Z8 [( D5 w5 Y" o
/ Q# ^# m0 H+ C* E3 L- c* Ivar copyspeed=marqueespeed9 s! j* l- i q
var pausespeed=(pauseit==0)? copyspeed: 05 u( E) }, x2 ]" M' }6 l# Y$ X) ~
var iedom=document.all||document.getElementById
0 s' x/ P2 ?2 z5 rif (iedom)2 m& w, Q9 d! L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( M( i$ E0 z- Y6 \/ y7 [var actualwidth=''
+ \) \& M* p' \var cross_marquee, ns_marquee
$ b" O9 \* S' E6 s/ p
% A* I7 D; h: Ffunction populate(){
) v7 a) d' G, b t6 Vif (iedom){
/ Q1 f' T" I9 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 v( w3 g" C. T+ h) Q" pcross_marquee.style.left=marqueewidth+8
" L0 j, h2 r# x" I- pcross_marquee.innerHTML=marqueecontent5 l8 Z+ S+ W4 i/ `& f; r$ {+ {7 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: T8 ^' t8 u; @( z9 ?' Y}
$ P1 \0 T. C' \8 s& A; j" melse if (document.layers){
% n( x: v5 g1 @, g! d( L5 ens_marquee=document.ns_marquee.document.ns_marquee24 x! U( [: H& v% I2 D9 d+ K+ K) z
ns_marquee.left=marqueewidth+8, n: Y* h( X" R* D
ns_marquee.document.write(marqueecontent), ~2 c. e& d# ]& g; r: N' s" O
ns_marquee.document.close()& V B8 W% z6 z& o% n0 p% ~ J. }
actualwidth=ns_marquee.document.width' U+ x3 P+ m% h( V/ k& K- R
}9 u* R5 O% x. c z1 o
lefttime=setInterval("scrollmarquee()",20)
6 }' \8 I; h4 T5 T6 V" `4 M3 n}
3 h! T5 {! h/ Cwindow.onload=populate7 p& Q* q% i6 I9 p
% t; U- O/ k( ~# @* ?function scrollmarquee(){
4 Y9 ^) t4 h6 w: G* C' x. z- J+ ]if (iedom){5 `' S% b; j# S' X+ a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 B3 H, \4 ^; u: L1 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* J1 T4 H; o7 ` N% t
else; U ^: T: A$ X+ J/ p1 s
cross_marquee.style.left=marqueewidth+87 X& B) u: m5 ?# c5 t9 A
4 [+ L* p0 V1 [}( i4 n/ |, ~) ]8 g2 Y# ?' U
else if (document.layers){+ }% Y! k5 W+ E7 R9 w K
if (ns_marquee.left>(actualwidth*(-1)+8))
! x3 x7 }. P+ v4 W/ `" g/ G2 o' Dns_marquee.left-=copyspeed
; H: P+ d \5 J$ Z% I) f7 O5 B" relse
& H* y1 M/ \% X; b2 B4 S9 T4 Lns_marquee.left=marqueewidth+8
# P8 |( O/ l9 i- ^' t2 s}9 }4 j6 N1 ~# Y; ?
}8 P: U1 k8 f$ M: a; P; ?
" |( k7 F/ S8 l# f7 ?: s) O& u
if (iedom||document.layers){+ Y& w3 c8 A+ h, H/ \, m
with (document){. _( u- p; \- M4 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! x- b, \: k' |5 C# q9 C
if (iedom){
( K4 c6 y0 n5 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
I- c& M- ?& t9 {1 m5 j7 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 C$ n& j; Z6 z5 E: T5 }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% C4 b: ` c" u4 o; [- a( \
write('</div>')
* q8 G! {3 ^. ?+ B" m' a}
B, N& t) @6 J* d6 ^/ Belse if (document.layers){
/ q/ E" s' o. ?0 R' Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ B( a8 @5 l1 r4 S3 y3 gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) E+ b$ {6 c+ b3 @write('</ilayer>')
9 y) b) E, s+ E}' r3 j1 H- N; i4 n, h
document.write('</td></table>')7 K9 `" Z$ |( Q0 Z- U! _' U
}
]& Z2 D+ u2 c/ U}
: M% p& e( [4 ?</script> |
|