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

|
网页之跑马灯文字特效
//修改宽度
8 n% j6 I3 i% T7 ~6 Dvar marqueewidth=300
6 t1 F2 w8 c; Z* y1 y# c( E//高度. K: Q% @) C- M; e, g
var marqueeheight=25% p% M l' D& [
//速度(1-10)
2 g- s5 l' `7 a- ?var marqueespeed=3& D2 e* c" V, O7 Z) H
//背景颜色
( d* {% |( y+ Lvar marqueebgcolor="#FFFFFF"
( P# N3 y! ]+ |" |( C* F2 T//是否能暂停 (0=no. 1=yes)?
8 n$ ]/ g% K: d" I6 @% N, ~) qvar pauseit=1
6 G* v; Q3 Y6 i3 }. D) G
3 l0 J, Z* B; i, T H//修改显示内容2 k$ ]5 L+ z% q1 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" o8 Q7 q2 ?4 q# y# e
! ] A b# E! w- J" r6 V$ M1 C3 x- T- z2 i Y
////下面不需改变////////////; e" y- \# S& A4 b+ i& {3 D
$ S) x6 \7 p" h$ o7 Q `3 Cvar copyspeed=marqueespeed
I9 ]$ q7 p& zvar pausespeed=(pauseit==0)? copyspeed: 0
7 R' p# }2 _9 J4 w9 N |var iedom=document.all||document.getElementById8 u" H9 {: f7 ?' O2 ?
if (iedom)
8 x* r" y2 I3 D, }+ O7 g% kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). w, l7 Q9 G: X
var actualwidth=''
4 H: Q7 I) V) e" n7 y) |var cross_marquee, ns_marquee
0 ~1 \7 N1 w4 _( [6 g J
2 L1 J6 q7 |# efunction populate(){ A# `* H! W- ~, F; f: W
if (iedom){
" t* Y; ?! S9 ]# [& U9 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 f4 }- x8 g4 m, C$ Rcross_marquee.style.left=marqueewidth+8
; C" j' W3 ]* |6 I0 G+ W1 F9 \& Ycross_marquee.innerHTML=marqueecontent+ O5 I# Y9 X: f# L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
J# ~6 w* b8 e' l}
5 t1 f; I; m) a7 U1 @0 Melse if (document.layers){
, B6 W. ~3 z6 C0 D' ?ns_marquee=document.ns_marquee.document.ns_marquee2
4 j0 E6 v7 i) P7 R& f% `( r9 Ins_marquee.left=marqueewidth+89 J$ z9 p5 e7 [7 l
ns_marquee.document.write(marqueecontent) P& V s( V6 S g# J
ns_marquee.document.close()
+ X8 ^4 Z, z; ~0 Mactualwidth=ns_marquee.document.width
t7 Y6 `; P, f3 k. q9 A}1 f. m6 r3 J3 \% p% U8 C
lefttime=setInterval("scrollmarquee()",20)" V) D4 M' w* {+ ?1 a! b! v
}
) a: p+ [' |# q! [window.onload=populate
/ s, J$ _4 i; W! s; `. C3 K V% ^# X1 U& @, b' r; d
function scrollmarquee(){. g# ?* t% M8 H8 O
if (iedom){
) Z& _, X. X) G9 ~. C! Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) O3 h. o1 }% l& Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% p% P, r& q1 }1 g0 t3 B, ielse# B2 v% V; W2 B& X
cross_marquee.style.left=marqueewidth+8/ C. m" `% H0 a- V
7 W. U9 o5 O+ J}
8 ]& T) Y0 H; C+ U2 C9 [7 belse if (document.layers){% T" Q4 i# e1 a5 p
if (ns_marquee.left>(actualwidth*(-1)+8))- J2 } [( ~2 s. V3 B- v! ?+ C- T
ns_marquee.left-=copyspeed
# W, T* c3 D+ jelse
4 |. H& Z6 O+ P6 \7 Q: Cns_marquee.left=marqueewidth+8
/ N2 Z% q Q/ l' { j: [}
# v6 U% I2 F4 T* ^8 W! [" K0 g}5 K4 Q) K& p0 A- y4 Q
8 D( f3 w7 o% \' z( qif (iedom||document.layers){
& a. ~* B* K& Vwith (document){7 T1 P2 w6 g$ _- g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') L% `& j; Z+ I* y! a- T
if (iedom){! q% a3 e& V) H! u" K3 W0 @; u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! N# |% [+ z1 U1 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- E9 I! G% w7 n# U: A7 O: mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 }$ D1 s c L* ^7 _- F, t- J
write('</div>')5 U( T- k& P9 G$ O
}
- D/ y) v) ~* Z4 Kelse if (document.layers){8 ]6 Z! c8 p0 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ }: ~( I+ u8 _& ~. V: zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 e5 U) _4 D6 t) Kwrite('</ilayer>')9 F# a: ~9 J) q! ?3 [8 p
}
; j, N1 i: y6 Ddocument.write('</td></table>')
* l$ ?9 K- d3 N L! d! V1 Z6 q! D}
; f/ h$ M5 A3 f- c. }' E}
2 A6 Y' [8 }6 k% r- f! y. Q/ @</script> |
|