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

|
网页之跑马灯文字特效
//修改宽度
9 o) J4 \4 g7 F: T9 W, @var marqueewidth=300
8 e# \) H; g5 x4 b: N//高度( v$ r6 P! N( v, T& g1 \) \6 ~
var marqueeheight=25
# m" |9 E: d) `: O: |# h6 p//速度(1-10)
4 _) y) J- l# lvar marqueespeed=3% | t7 |# b8 Z8 Q) P3 Z# w, ^
//背景颜色
2 q- Q; x* [ D7 |" zvar marqueebgcolor="#FFFFFF"
7 c( C, [" D5 _/ h% ^//是否能暂停 (0=no. 1=yes)?& e1 V1 [# o: z: h. M; w
var pauseit=11 P1 s! k+ r6 J5 W
( f; a0 `7 h4 ?, q3 W0 z1 \& N" u$ q! I
//修改显示内容2 @! y2 K8 Z9 c, G# O, N& Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ~% e6 n* U' [/ A- l
- \0 o$ i* V* n8 ~/ G4 q! S# N4 \! }7 @) x& D. d+ X6 l
////下面不需改变////////////
/ q* P& u' A7 M9 W3 U# F* s2 ~: K4 U; R
var copyspeed=marqueespeed5 P8 C% h' c. @% H3 M0 K
var pausespeed=(pauseit==0)? copyspeed: 00 V) L/ i- a8 }: Z, T4 A; r2 v% r
var iedom=document.all||document.getElementById
$ M1 C0 }0 w- `8 [. A3 }+ Sif (iedom)
# d2 U, B9 B/ p" b1 P: N0 k3 \: cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 E9 y2 |) |( q6 Y# {var actualwidth=''6 C8 H; R9 E! m& F1 y X
var cross_marquee, ns_marquee" p4 R4 M9 {, l0 D
) S$ I W6 D. L' Qfunction populate(){' z( R2 W5 A \1 \2 {, v
if (iedom){
0 S$ X: J3 l: D7 w% D- M+ {3 t; ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ M/ }* e. t ?+ A& J, @cross_marquee.style.left=marqueewidth+8& y* g' _3 s# m
cross_marquee.innerHTML=marqueecontent
9 A' | p, g/ _! \+ w& ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 D! x; h- M+ F& Z5 x6 @
}
7 g+ C; S' s$ e; P8 W# D Relse if (document.layers){
( Y1 i/ G$ U0 F) A; Ens_marquee=document.ns_marquee.document.ns_marquee2
1 C% q+ a6 i& z' s; ^ns_marquee.left=marqueewidth+8
) ^2 m: ]* M: D% d0 Cns_marquee.document.write(marqueecontent)7 q) R5 D: E; L1 U
ns_marquee.document.close()7 L) s+ _, f) k
actualwidth=ns_marquee.document.width
: o( T1 d; D+ M* [3 Q}
, @! [* L8 i h8 f4 O% X0 q* mlefttime=setInterval("scrollmarquee()",20)
, x, b) ]' Z5 D* X}4 R: u2 H K6 ^
window.onload=populate$ u0 v* ^; r9 J8 y& J* s1 J2 h# g
& \4 J+ Z2 j8 h9 I+ h! _$ ofunction scrollmarquee(){
: L |0 U/ h9 s. qif (iedom){/ G, c- x5 c2 ]7 `; O7 m2 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" b& M! L3 b% ?7 a% r2 A+ d. A7 P( vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 f5 r) x) Q B# Pelse# J* {& o" ^6 x, N$ d- s9 N% |
cross_marquee.style.left=marqueewidth+8
' V! `) s+ q2 r
9 M( c. J2 c+ y5 A}
3 `$ [- \1 k3 \else if (document.layers){
3 ?0 e6 h4 U/ j* L# G" w: X$ aif (ns_marquee.left>(actualwidth*(-1)+8))
2 F! c2 {2 C( B: ons_marquee.left-=copyspeed
. b7 S2 y, ]* D; y$ u! Ielse
3 r4 d; _1 T3 R; `4 i! a' x. O) hns_marquee.left=marqueewidth+8
8 K8 }1 n, y' Z7 ]2 @}
; j/ `6 h& R! g/ |5 J0 U}
. U' ?. G+ G t2 @) o- x' D: n6 t: z6 N4 i$ W8 E8 n4 v- ?
if (iedom||document.layers){6 h- p ~( h& @
with (document){3 b& y a4 F+ D( c' |: k' g2 L% Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" M6 o' p1 }: Iif (iedom){" C b4 J+ d; w* n* Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 S! ?* {5 Z( a' Q* N1 H awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), m+ G9 M5 L- N# r! z+ H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" E: G$ A8 l9 o' j- u9 L7 G
write('</div>')
0 M v: l, D+ U0 P- U3 H. `}
: b u) g3 B- \& H# F- X3 celse if (document.layers){
. k- S% [6 b9 X; ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ h. G5 R5 Y! [7 h; V+ I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" X+ R/ U6 \) I9 R1 L) X" W* bwrite('</ilayer>')0 `5 E- Z7 D. D( ]
}8 N9 X1 r+ a: c- N9 [ G) f
document.write('</td></table>')
5 R3 _& }3 F6 r}: ]3 `3 S" U- L9 d4 F p
}
% N' P n$ ?9 Y: V( z, A. E, [</script> |
|