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

|
网页之跑马灯文字特效
//修改宽度& T. L, }2 N& G, F7 m. _
var marqueewidth=300
- j# x) x b5 e8 q+ ?+ c. N- @9 M//高度
) G' w+ Y, i; yvar marqueeheight=25
S: W5 I4 y5 j& e//速度(1-10)
3 a: Q" t" t" D/ C1 M6 {% Ovar marqueespeed=35 c/ M0 G* Y7 J- K2 `+ J# N) E
//背景颜色$ |1 x: h0 k' H% a- n8 m, ^
var marqueebgcolor="#FFFFFF"8 k% R o4 X' Z: V# j0 f: w+ Y" e
//是否能暂停 (0=no. 1=yes)?
: }- h9 C$ V) T- L1 cvar pauseit=1/ Z8 s. B. J! J
f" e$ U# o" @5 F( y; l
//修改显示内容2 Q) _ m" p, R: C1 c& K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 S+ k8 u* }3 i( A9 k, K. b
* Y w4 E; c* t b9 D; ^
7 b k( N: L9 K7 t////下面不需改变////////////9 W! c$ s+ q3 F# F q
% j( ~& _9 z. ?: [& `var copyspeed=marqueespeed! `6 @' S. i" ^# b8 `
var pausespeed=(pauseit==0)? copyspeed: 0
/ A5 O4 q7 Q9 ]7 Avar iedom=document.all||document.getElementById
8 B$ s9 e. t P% `) \: Qif (iedom)
6 L4 o2 y j2 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 l) X3 b; u) J0 U0 i3 m+ p* |& M
var actualwidth=''
6 F9 @5 y8 H1 b2 |var cross_marquee, ns_marquee, P% e2 u# H P% U6 G
) E7 t8 ~5 |' k/ I( D* Zfunction populate(){
- o/ x2 h# b* h% f) pif (iedom){* e# w7 p. \/ g' n( @% C8 D' L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 P1 J% a' n6 Ecross_marquee.style.left=marqueewidth+8. H/ T" j6 R7 F, [9 S
cross_marquee.innerHTML=marqueecontent+ Z" ~+ O% Z) X$ ^$ O6 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. u6 f. z( d2 W- U# e/ k, U" ^) i) @1 s
}0 @" M4 c# t Q B& @
else if (document.layers){- t, t, Q% t8 G' N6 X/ @, q. g
ns_marquee=document.ns_marquee.document.ns_marquee2
8 t% \5 H' e' Rns_marquee.left=marqueewidth+8" v9 k6 D( Q; p) A/ z
ns_marquee.document.write(marqueecontent)
* I) ~! `2 W( B2 Z% b- yns_marquee.document.close()
+ j( s3 U; F) j, mactualwidth=ns_marquee.document.width" ~/ i0 K" Z4 |: v/ e
}3 d4 C$ B d: s+ M4 ~* O- g9 o0 A
lefttime=setInterval("scrollmarquee()",20)% P9 n) ]8 j& t) s! k- M4 j
}
S) H8 h# p6 N- e# Awindow.onload=populate
% R$ n, D- x6 N3 n6 e( S, w! ]: \( Y: U: K1 G% C9 {
function scrollmarquee(){
. l0 t2 j) T. ?8 I4 o6 X+ Cif (iedom){
, O7 R1 z( ~/ I( U" H% R' g/ jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 X3 z9 _/ E0 d( M/ T* Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 h b+ N. W) }8 o) relse
! m8 q$ o2 ?. x# across_marquee.style.left=marqueewidth+85 @$ u% H: k' Q- r! A# N
4 |7 B2 [' @9 g' {}; E9 K3 Z' o4 i
else if (document.layers){& X7 K& }8 g# c3 R) d) [/ D
if (ns_marquee.left>(actualwidth*(-1)+8))
0 U- x2 b. Q: O6 Lns_marquee.left-=copyspeed
: N y8 a8 ]: R$ Z; q: Uelse
: w2 i/ | G8 n) |! H5 Ons_marquee.left=marqueewidth+8: }4 G0 a9 S3 K: E9 n" W) m
}6 e E* u- E$ K7 ?. t
}' e: W1 S/ u5 H3 s
8 g9 o0 b3 q, G' k8 d0 {4 K7 wif (iedom||document.layers){
% V- D8 `! q! u; t- j1 d. Jwith (document){4 E5 D" `) \# v$ v" s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' w2 ]# {$ p2 G/ y3 ^2 wif (iedom){
5 x2 U* H, o% R, |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# R& b9 h! V) T' I. vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), F4 Y, g8 d+ p2 w; C4 ^- |, ^ n: m! \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), r9 n- T3 O- U) o4 @0 B) ^/ f
write('</div>')5 ?2 a- l1 @ N6 n7 H
}
% ?# e- ^0 [ z+ melse if (document.layers){
4 ^: n, Y* ?% z$ m' O0 G7 Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 }6 O& G& g2 L8 F/ K6 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 z& C; m% m+ z& h/ k1 e: u, d
write('</ilayer>')
; \* ^, J4 Q* E}. S8 M7 U# E$ P O; ^
document.write('</td></table>')9 t9 M( H- n' p: u c! b
}# J+ t( r0 A! S- G- @( d& ]
}
0 s+ H: ^0 j) T</script> |
|