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

|
网页之跑马灯文字特效
//修改宽度8 u% B1 k! @8 D( c; _/ q
var marqueewidth=300
4 y( j1 r1 o. ~3 `% T$ _) h//高度
* X3 I! _8 Q) |- X$ {var marqueeheight=25
4 `# H! ~# P- d, h//速度(1-10)
. U1 g( h' | |5 N4 }5 Kvar marqueespeed=39 w$ J% t6 O* X
//背景颜色
& w6 y) B) a! ~ E Gvar marqueebgcolor="#FFFFFF"
, i8 d/ L0 \1 {, j9 L//是否能暂停 (0=no. 1=yes)?* c8 M- z) `2 M; n4 s& C1 z3 `! R0 [- K
var pauseit=1, R# c. k0 i$ W: P& b+ e( c
4 t( q$ Z- ^6 R* v* J//修改显示内容* Y' |# q3 G$ I8 A+ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! U" Y- s% s1 O5 t: J; M" B% K6 W9 C) @
9 u. C, Q/ w2 @3 I- z////下面不需改变////////////: F5 r; m( @* U
. S: S, W% l+ X3 F. q$ U- V
var copyspeed=marqueespeed! [1 F; Y* S" _; e5 i
var pausespeed=(pauseit==0)? copyspeed: 0
! v) `( r: g6 T0 uvar iedom=document.all||document.getElementById. a, P1 j# u3 @! @+ V
if (iedom)
4 O" z2 Q( Q9 ?. V# \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) }8 h3 e2 U/ ^! H7 M
var actualwidth=''
( V. t* i8 @' Q3 P9 I* D, ovar cross_marquee, ns_marquee$ {7 |* _) W5 G
+ o* Q' W6 F, @$ h' U
function populate(){4 h: l1 S5 Z2 l+ b5 g
if (iedom){ P7 ]4 w1 E( P* o6 S6 [* ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ y. y; X; k2 u3 ^* l3 v7 across_marquee.style.left=marqueewidth+8
0 \+ Z# O8 z: ]) Jcross_marquee.innerHTML=marqueecontent
. f" q [7 ^1 K1 s. T5 Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" K" K6 M- Q X7 C8 E( E8 p}
4 q/ }0 Z1 M& u: F& _else if (document.layers){
8 o9 j0 F; x4 Q- D( r c' qns_marquee=document.ns_marquee.document.ns_marquee29 c9 m% v9 g0 E9 \& B$ U) d3 s
ns_marquee.left=marqueewidth+8
, i2 U B0 d/ z$ Q; l) K: Bns_marquee.document.write(marqueecontent)
) Q# L+ }2 K3 e) c/ tns_marquee.document.close()
3 Y$ M: |; G, `* R+ a/ Qactualwidth=ns_marquee.document.width4 e6 d' N+ U3 Q
}& m. F: L. E* y& l$ k
lefttime=setInterval("scrollmarquee()",20)5 d, m& \ V; i# ^
}/ J6 w8 Y$ G' n1 b3 ~( z0 S
window.onload=populate
# p* D6 Y5 ^! [5 o0 w7 v1 v/ t6 F+ _- J
function scrollmarquee(){
( ^) ?& G1 }0 \if (iedom){
0 p& i( t$ S- lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( S; Z) Q i( {. t& R* j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 u4 w1 y5 b& [! {# V* \( M, d
else
/ [, G5 r: P* q$ u; ycross_marquee.style.left=marqueewidth+83 C2 L1 y! c; B& c
- o. M: F5 {8 K" w4 Z}5 U6 y) w& ?9 ^. H7 P# a) N
else if (document.layers){5 W, Q0 c5 u% B% @ W
if (ns_marquee.left>(actualwidth*(-1)+8)), c0 C7 z( a8 u& Q, u( |) ~
ns_marquee.left-=copyspeed& L) P# U* d+ W& F2 o) K
else
4 a( z% ]9 q. N* y$ L3 Yns_marquee.left=marqueewidth+8
' w) h1 e. p% o* R* Z: X6 I}
/ i2 N6 e# D( d1 B* @& q# E" s}
3 [; d3 ]! ?' A# o2 Y
/ r; k7 W. s. _3 P; J% dif (iedom||document.layers){( [/ ]. ?0 \* _( T5 [
with (document){
" a$ b2 j) a& |" Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 y1 e1 B1 ]2 r
if (iedom){
, F' z" d& ^0 [1 j9 Q; o4 H5 o* Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). w) ?: i# l8 J& j4 u: X9 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) A. m7 x. _5 B. w; }$ Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Q5 ^! R: J# Y1 K2 X+ x& L7 v
write('</div>')8 m% _) ~7 q( Q5 Z3 Z' \
}* c% p4 t1 T$ B" n
else if (document.layers){
9 K0 q" H9 F8 g) N" k2 p# Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 m- w3 w. o# d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 w( F0 G& x1 u1 T; v W$ F8 q
write('</ilayer>')
* e9 b" y- }8 O9 Q; w}
1 }% c/ b2 e) H7 [. Y/ T& V/ o0 zdocument.write('</td></table>')
. ^5 q! R- k1 v. @) R- w1 ]+ R: B}5 s) N$ |2 h+ `
}
3 }% e3 H7 @# e& L& ?5 X</script> |
|