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

|
网页之跑马灯文字特效
//修改宽度
6 c% r& u% x: J9 t2 r5 ^var marqueewidth=300
. ~7 `* B) P9 Y3 T& Q1 l# R" M$ ~//高度
9 @* }% q7 n h9 }var marqueeheight=25
, n, O* g# P% W//速度(1-10); w4 J& C% _5 |0 T; S, Y- C
var marqueespeed=3' H3 r0 C! v9 ]" s' G( i, Z" t
//背景颜色
( y$ l" T$ W1 e* u9 Z# Pvar marqueebgcolor="#FFFFFF"4 v2 y B$ d, y. r7 Y# F) C
//是否能暂停 (0=no. 1=yes)?
, E( x# x* q6 d# T9 O% b: ]var pauseit=1
" ~* T7 T4 E1 P. y' k/ Z, L) @9 J7 A
% g* ?# G6 [* W+ \% v9 L//修改显示内容* c0 J( ?1 K1 Z$ S- u* u0 ]# B N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': F5 x( o4 @8 |2 x; h' Y
) @0 T1 ?+ E6 C
) w8 }2 w. u) y7 L
////下面不需改变////////////
! l9 ?5 T4 i' T( _7 t j& A& f2 T9 d2 N( q% D
var copyspeed=marqueespeed
4 ~7 D# O# _# a$ F6 Hvar pausespeed=(pauseit==0)? copyspeed: 0
- P- P9 `6 E4 G! Kvar iedom=document.all||document.getElementById# k$ _, A& L) n! u6 n
if (iedom)0 w, I) P! @3 F8 X7 J$ }& P. v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 M# [4 t7 R6 _3 R
var actualwidth=''
4 L" x) \2 \ h- C4 s) k' `var cross_marquee, ns_marquee" K) ?0 H/ u& s& V* `+ K
' y9 D8 k8 F) Y+ e- C7 }$ e! b
function populate(){- {2 J; Z4 F7 V8 p" n
if (iedom){
9 |. R3 M. K5 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ^+ h' ?8 Q4 H9 w7 P
cross_marquee.style.left=marqueewidth+8
; r5 O7 S: X8 u2 f) b5 M5 }6 j3 ecross_marquee.innerHTML=marqueecontent
+ G7 S2 H& D1 c6 b/ Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ e9 i' h( ?- \7 B N}7 y5 |- \3 G, x6 \
else if (document.layers){, @! F% C+ E, `" Z2 r' ]% w
ns_marquee=document.ns_marquee.document.ns_marquee23 J/ x, h0 B5 S$ u' p6 Y
ns_marquee.left=marqueewidth+8
7 c3 e( q2 n6 `3 x% h5 ~, b8 U7 ~ns_marquee.document.write(marqueecontent)
- S Z' `: i, r7 ~5 N+ t( Z+ f" Ans_marquee.document.close()
! o1 I9 q2 P7 j1 J6 Gactualwidth=ns_marquee.document.width
" F5 `+ M1 O0 q% [}" H! d# F/ G6 c) l
lefttime=setInterval("scrollmarquee()",20)* T; b& E1 \, f6 J& G: g$ I
}6 {& A; f' C/ q2 h0 P
window.onload=populate
+ i K5 U" K% Q. \- a) {4 h0 l. |/ F( W
function scrollmarquee(){
0 F* ^: F& v( O) n' J& gif (iedom){
3 {) ]) {3 q2 T5 ]0 m; p$ l' Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- B# C2 T* W4 x# s4 G, y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
v3 x; U% _: W' delse
/ a& c% N: ~7 `! E ocross_marquee.style.left=marqueewidth+8
4 l2 a( }3 }% {$ H# c2 m8 `% Y3 q* ~; ?$ u5 }' [
}+ u9 Y3 G+ Z# ` X. {# X1 z3 I
else if (document.layers){
- ]5 ~# ^2 n( q+ ~" j/ Fif (ns_marquee.left>(actualwidth*(-1)+8))/ W+ a$ i; l7 n( P: f) l7 b, u
ns_marquee.left-=copyspeed
- c0 l( v; W! melse
' G `2 ^3 q v9 R1 `- O6 Zns_marquee.left=marqueewidth+86 x* B3 l7 q; b; X
} [3 u' z; Y O# a, N6 D1 S
}
- d: n& ]; b9 j/ R
% R9 z! G% Y8 H& c" f9 j: v% dif (iedom||document.layers){
; a: G9 G) Y5 C7 [) _: B7 w2 nwith (document){
0 H* ~" C$ m5 l7 o2 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') z' F! w4 j+ ^, {; k4 p
if (iedom){: c$ x: r* N5 a5 k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), c- B. Y0 t N% z5 S8 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 o% p6 m, d- F; p9 k0 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
K S% n, p6 _. `& @6 ywrite('</div>')" V2 X7 c% z) C R8 n+ l
}+ t( `) C# Q3 R
else if (document.layers){% {8 ^8 R# }$ |* w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% J' t) w2 a2 [9 e* mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 n+ H* l+ }. J' @' m* s1 X
write('</ilayer>')! d6 D9 v6 T1 }+ G5 J' A& }+ N6 u
}3 v/ h x& X5 c
document.write('</td></table>')
9 c3 g4 c: J% b, Q, j: I}, Y3 k1 S+ Y5 a9 n t2 S3 f4 ]
}
, `0 o3 O% S$ q. ]" C</script> |
|