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

|
网页之跑马灯文字特效
//修改宽度! q( G; D' \4 J- L) g& L# v' Z
var marqueewidth=3000 t$ _) U5 P2 s9 U4 @9 H5 Z
//高度$ G% _: y( f. _2 c. h: Q$ k
var marqueeheight=25
! n6 j3 d4 M2 r/ p# P) U//速度(1-10)' g2 m8 ~4 i* ]3 Q3 |6 [9 `% D
var marqueespeed=3: J0 D8 g# Q+ V; w* k' Y
//背景颜色
+ p. U) u* K/ }var marqueebgcolor="#FFFFFF"5 d3 x- v B/ }8 d+ g, |. r
//是否能暂停 (0=no. 1=yes)?; N, Q+ ^& T, b
var pauseit=1
) a& y9 {# @* p5 I) y8 m2 J% L0 r& i- Q
//修改显示内容
* b+ |! @' f# x: r, Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') m b; m8 U& {
1 o! b+ c7 o; o" b3 P
, {" C: f9 b3 n) Q: `////下面不需改变////////////" ^6 Z% q3 ?: y) r
+ P; X5 l+ ]( X qvar copyspeed=marqueespeed
`4 Y" P D9 e) K0 M& {var pausespeed=(pauseit==0)? copyspeed: 0
% Q+ _" W: ^& V- q, J) _var iedom=document.all||document.getElementById
; ]# w9 G! }0 i d4 h0 }if (iedom)* Z8 I4 w$ y. V' p2 Z* l0 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' M2 s( Y' c9 [+ _var actualwidth=''
: I' l0 ~5 u5 w4 k) R/ r" Kvar cross_marquee, ns_marquee
d( E+ `/ h, p, K! s& l! \; S2 R6 o: b5 j/ m# G& D7 D6 H
function populate(){
2 l/ |) U! N( rif (iedom){
8 Z' o$ y% x1 U/ f' }+ S5 E1 pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 w" s! y9 B9 u( W& T9 s) qcross_marquee.style.left=marqueewidth+8
, E6 O; \6 W: H3 hcross_marquee.innerHTML=marqueecontent+ C1 K9 P4 z7 H, d7 _% N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth r* f4 Z- M5 {. ^- C
}
3 M2 x, }5 ~4 b+ Q6 ~else if (document.layers){
; N1 [: b1 w! M5 q1 ens_marquee=document.ns_marquee.document.ns_marquee24 U- u" J6 G6 n, s8 F
ns_marquee.left=marqueewidth+8
% f* l; {9 e3 F9 ons_marquee.document.write(marqueecontent)/ r6 \4 w3 _& l! L) p& V3 n8 s e
ns_marquee.document.close()
+ p( e/ G7 ~; Y9 `0 u9 Lactualwidth=ns_marquee.document.width
4 n! v$ t3 r3 U% @! F* `# v}
# X& I' j! e' d$ D4 ]2 b& Blefttime=setInterval("scrollmarquee()",20), v; w8 ?6 Q- T) ^# c. q2 V' ~
}
5 x0 Y* Z& _2 M) J3 Ywindow.onload=populate! V1 J7 c8 V, w
. c# I4 F3 J) u" zfunction scrollmarquee(){3 `% B% b- v( q" ^% O" T4 u# Q
if (iedom){5 V; ^" [/ A& M9 K! I; i# d/ L# f) W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 z5 w5 q6 J- l0 u, D$ D) Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ G0 ~1 G' C! q3 A9 A+ E
else
8 T. R$ \" s5 B6 Ecross_marquee.style.left=marqueewidth+8' W4 K' W" t: b/ o: h) x2 y. D
) S0 f7 O; F0 V) u5 Z}, y. x9 B2 ]1 G& F
else if (document.layers){
! @ f4 f4 W& `9 Y8 Eif (ns_marquee.left>(actualwidth*(-1)+8))
- K: v: J' Q+ N0 H# I9 H7 Mns_marquee.left-=copyspeed% r& Q" D. r# [9 c
else
% h; X) g. W) a8 U4 a9 o) v5 @ns_marquee.left=marqueewidth+8) u9 S2 {. m" e$ b9 X
}
) E/ f# R. V1 X6 a0 C}
' u" d$ q7 j t/ V1 G
1 D% v* `7 i6 o- |9 f4 U( k, nif (iedom||document.layers){
' A- @# q1 W* E3 R8 Pwith (document){$ N* B" m: D! a# W( g) K* {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. s6 O! n! _) O" U* Y) a' Tif (iedom){# B X5 G- a. J* K/ J3 @1 ~. t# d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 g' X+ D; t$ E4 l# G% \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 ~" Y' F7 V# B& |% d2 k+ {& C. L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 }9 h7 l7 K8 W+ dwrite('</div>')
" {: ?9 {' C) {- C2 k3 k# X4 l" N}! M' {; G d- i* X9 [( M) b
else if (document.layers){8 s+ W; g2 s3 z5 @/ B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). N3 s, M) }- R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 {' a! M4 h" P$ h% i
write('</ilayer>')
* e8 X3 Y1 h U5 A8 U# r}2 n, b+ P4 R; p
document.write('</td></table>')7 q4 N( ~% b4 H) L( g/ }0 c+ s; D* ?
}' n4 C2 i; n$ {( R- i- @
}2 ~; K9 _, \9 @1 y' m( v
</script> |
|