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

|
网页之跑马灯文字特效
//修改宽度
2 B/ ?$ N; n3 ]( `* n3 ]var marqueewidth=300+ U1 g6 n4 z+ W. j% B
//高度+ k8 }1 V4 A; f; q) _/ V
var marqueeheight=25
+ F, U) O" n1 @. o//速度(1-10)# ]! s& F' Q" c2 }* z; g6 G' M4 r
var marqueespeed=3
# \5 T( o* b* ?0 P$ `3 U- B//背景颜色
" Y+ {% a! @4 m7 rvar marqueebgcolor="#FFFFFF"
' ~ Z- B" b/ P//是否能暂停 (0=no. 1=yes)?
9 D: E" p, Y0 q( H b0 M/ V" Rvar pauseit=1: i7 {) e1 t5 Z3 j' U
5 o w U4 |6 `; l/ N//修改显示内容
1 x' j( D& }0 s! u- `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 e. |% F2 X7 W
_8 d# {1 y @ q `. ?, z5 |, e7 t# G' d+ h9 Z# n
////下面不需改变////////////3 T9 d; I2 O7 ~9 |& {# f
# f7 v2 V1 h4 P" {( Cvar copyspeed=marqueespeed" \1 b& z6 |$ k
var pausespeed=(pauseit==0)? copyspeed: 0
1 o0 Y% G. C; D! Y, @1 W4 N+ _var iedom=document.all||document.getElementById
5 d0 a/ M" `; o% wif (iedom)+ r$ G& o& T) n: {4 C: k* y; f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 }) y! I; n1 ^ K
var actualwidth=''
- U: n. i; s. Avar cross_marquee, ns_marquee
3 D. j+ g: _5 J! W$ i; C8 V5 l2 Y0 k
function populate(){
: V+ m- n( |3 i( d) I+ G* |: ~if (iedom){
2 A1 c# @6 v8 J3 T+ ^- hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- }. x2 b; v% f" Zcross_marquee.style.left=marqueewidth+8
; w. k9 Q3 F: U, H3 y1 Ucross_marquee.innerHTML=marqueecontent' \" b% Z4 s# Z5 R3 I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 p+ k( X# Y% J- a6 j. |0 p$ ^1 V3 P9 A
}
+ A$ Z t2 u5 Z# `7 nelse if (document.layers){5 T6 Z/ \% o6 v$ m: V1 P
ns_marquee=document.ns_marquee.document.ns_marquee2
* r% z2 W2 _. B' t7 k" P. Bns_marquee.left=marqueewidth+8
, K( s9 [0 i$ \& f7 w7 g; Kns_marquee.document.write(marqueecontent)
; Y# j) X7 D2 l( I- u: ?ns_marquee.document.close()5 k5 K% Y" v) k _$ i/ G; s/ Q3 @$ Q F
actualwidth=ns_marquee.document.width
: Z h! Q3 A5 o2 X* `8 s}
, @0 v3 M/ ~7 B+ i- a: y+ N. g% ^lefttime=setInterval("scrollmarquee()",20)
+ |# g3 [% I- j5 B}
" r% U: k v+ f( i1 g; u, W! Q Pwindow.onload=populate; j* A3 H& q+ v' p4 d
% p% f% }* R. {5 I* Pfunction scrollmarquee(){
1 X7 p2 T6 `6 Y7 g2 X- k. v/ n! |# Dif (iedom){9 \3 K" y w' E$ }5 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 j! P8 Y: z9 g6 D& T" P6 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* w" ~! g/ r2 ~* ^& O2 h/ @
else
/ H0 X2 @" a# O7 F X1 w& Dcross_marquee.style.left=marqueewidth+8
5 G1 u! g4 i# |5 v
# K1 [7 I$ E: g4 b7 {8 L4 u}( K3 k6 _* t, M
else if (document.layers){ a5 n2 q, E. ]% t% V# H- Q
if (ns_marquee.left>(actualwidth*(-1)+8))& b4 e( s1 y6 d1 A* @
ns_marquee.left-=copyspeed
: R3 c( `1 a: Kelse
9 C# K$ K2 d$ v! Y Z" K# y, }$ ^) Tns_marquee.left=marqueewidth+8
1 C8 ~' k. z' F}
- w- F; Q( ?' Y4 e) `2 S, ~}* h# i9 [! H/ \2 L: K: x
' a0 f$ |1 {! l/ D @2 Mif (iedom||document.layers){5 Q- o3 k8 H3 J, J& j9 g6 j9 C
with (document){4 r- U( G! q. |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% m- W6 l; v& ~" }) }* ^
if (iedom){& [0 S3 G1 z0 t* A/ ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( K i1 m3 w( Y# bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ O& V7 A Q, a. }; J$ awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- Z$ r4 P; B; ]- w' e% S' Z, @ U! r0 kwrite('</div>')
4 I' n) N! b3 O8 `2 T9 S}
4 m- j/ I& ?! T; Y8 helse if (document.layers){
/ @5 e* X7 j- G" owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. i: u+ w( F7 dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). d/ `8 [8 P I
write('</ilayer>')
+ J' N2 V# g% G, ~8 ~2 X+ Z3 o}8 C4 E0 g0 t' H% _. a8 I. v! h
document.write('</td></table>')6 e* {& Y% a9 a# |+ f- {
}
& y9 y. s e% D}8 w7 u, m6 V) l3 O
</script> |
|