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

|
网页之跑马灯文字特效
//修改宽度
* Z3 R( c7 f: t, Y( v5 K6 qvar marqueewidth=300
5 d+ H7 p, y4 R; w- D5 v2 C//高度9 I( W) K5 B( ]% v) l, F: q8 ?. \6 E
var marqueeheight=25
& M) Q& w. [: l* j- B//速度(1-10); b1 h3 J& K" q- z! Y6 N+ d4 S0 ?
var marqueespeed=3
6 z2 G/ o' X4 Y# @/ t. Q( \/ f//背景颜色7 l8 s4 u* L( o9 [) e3 z
var marqueebgcolor="#FFFFFF"! l, F6 U" ]9 A4 l" m7 R2 }: l
//是否能暂停 (0=no. 1=yes)?" a8 O1 O7 c+ Y9 u, m% A- s5 N1 P
var pauseit=1* [! f0 n" @! d* t0 w
) |& M) D' d$ ?
//修改显示内容/ g2 Q- r; U( z) @$ |- A: w- G: y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 h( T; z2 T! D3 k9 N" \" j- Y& [4 B8 Y0 ~7 U: k: y
5 i1 m% X `' z6 z- o2 v6 A' i
////下面不需改变////////////
& g$ D2 T# i1 J% p5 L, V) ^, N7 r% }
var copyspeed=marqueespeed; S8 }) j1 r; J$ h; w4 W
var pausespeed=(pauseit==0)? copyspeed: 0
3 D7 v' T- N. n+ I4 kvar iedom=document.all||document.getElementById
" ^& K) ]( g1 c5 b5 {; xif (iedom)( G7 P( ?' [' i7 }/ l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 M: u) b+ t( F% P; b% A6 zvar actualwidth=''" |! r4 v" ^6 H% Y f4 n( b8 |% \
var cross_marquee, ns_marquee
! N7 r, A4 T4 \( F' g g, b1 V
! G8 `6 Z1 ^$ }1 s1 r9 Ufunction populate(){
. v6 S0 F# C& x! t( @/ z( Q) Sif (iedom){
% G8 f; n' }8 V" W8 ?7 r1 E( e/ b" ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 K0 p O+ x1 r0 a# P: N0 X9 D
cross_marquee.style.left=marqueewidth+8
+ a# i N6 F3 R. J' Wcross_marquee.innerHTML=marqueecontent0 i b; l' n# `5 ~6 Y, p: L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 j n' t5 i( `. Y; D8 V' }
}
$ \0 p1 W# O1 belse if (document.layers){
6 x7 I! l) ]6 E' @. ?4 w4 S/ Uns_marquee=document.ns_marquee.document.ns_marquee29 \$ [# |% J3 @9 G) T7 u7 N. F: _. l# r
ns_marquee.left=marqueewidth+8' [# S$ {* H$ w5 h. [
ns_marquee.document.write(marqueecontent)
/ h+ C; N9 a/ Jns_marquee.document.close()/ e. y- W! L9 M# t
actualwidth=ns_marquee.document.width+ A. \8 `# F$ R4 D
}
* b; Q7 {: U3 {# e& u9 W) v% X$ ]lefttime=setInterval("scrollmarquee()",20)
4 o4 z' b: K0 g1 V2 [ e}
# p, F5 R% d+ o; qwindow.onload=populate5 H Y& }, Z3 }6 o# v& h
& p% I2 H. G, g0 h( Lfunction scrollmarquee(){" n0 f- Q( ]* {( [
if (iedom){4 j. ` F6 _! t% z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 M" I, ]6 c1 X/ g0 w' ^, V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 h+ W) N. F0 l( R( e3 S# s% k2 jelse
; g1 @5 J* e6 t+ f0 ncross_marquee.style.left=marqueewidth+8
( o. g" |3 d& C7 o
' i* p6 V) d$ O# A}
5 {- y3 R( v3 a7 x+ P& F9 ~else if (document.layers){
: |3 {+ ]4 s- j" Q8 ?if (ns_marquee.left>(actualwidth*(-1)+8))
, j+ ?0 m. D7 s% i) S& f# L% Wns_marquee.left-=copyspeed
" m3 X9 c/ b( n: n/ T" H% welse) X, b9 Q1 }) Q% q
ns_marquee.left=marqueewidth+8% v* h' D' m! V4 D
}
6 s# D- C* a% }! o5 L! {}* V" }: ^* O0 U) w! G) T6 c
/ Q! r" ?" K3 b+ F* [2 H) X2 N
if (iedom||document.layers){
7 T0 ]% m' q9 B h1 c9 H# Gwith (document){
+ y( L# D& h5 B1 z( m; n4 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 _0 Z4 I" ]9 j; M3 w2 S
if (iedom){9 d9 K. q* g( Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& B! g# J) S/ t5 z; c! ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 d% H( d/ D$ S2 m2 h' |, cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! G ?, ?1 y7 x6 ewrite('</div>')% V$ S& H3 f9 P$ }, \4 E
}" f, e' @* W" B5 T6 P
else if (document.layers){
- O* ~+ K& O6 Q) }* T) O! N2 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 Y; Q) z7 l/ q6 ? S9 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; S- l: L8 R b3 h4 g6 zwrite('</ilayer>')
9 ~ Y* C- |6 h% s3 H' ?2 B}5 V! H. O, E$ ]0 a, m% {, W
document.write('</td></table>')
+ H, M) A% O2 G; J- }4 ^+ R}& b+ K! M$ i8 V
}
7 w" i8 \+ e; w</script> |
|