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

|
网页之跑马灯文字特效
//修改宽度
0 G% a+ F8 P) O$ _9 B" }6 [. nvar marqueewidth=3002 e) A* ~' R' q+ {' \- ?1 ~
//高度
1 c5 x, n' Q# D. l- t! Ovar marqueeheight=25! x) U" O7 N9 i* J
//速度(1-10)
' z+ \. E& U- F, @9 a( J8 `/ R8 Y1 Uvar marqueespeed=36 Y' X+ e6 C. G: W$ J
//背景颜色" Z; m; D3 X0 S# k3 I4 N' r
var marqueebgcolor="#FFFFFF"$ v' @/ j0 i7 w2 i0 z' n: J+ V3 o
//是否能暂停 (0=no. 1=yes)?
; |( a6 l- T! c* l1 ^7 Dvar pauseit=1
1 H, [5 X5 Q. ?8 y7 T
" A( I) ?+ M, u//修改显示内容9 Y( h; N- H7 f+ h/ }' U* N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* Q) W& K7 {% K7 y8 d+ p# E/ O5 n
& T) i2 B7 V' S, e* F# @9 C. X1 Q [3 a3 L
////下面不需改变////////////- v* a. \' c9 i$ ]$ F* G
$ ~, M P' g V% }4 v$ a) e
var copyspeed=marqueespeed, S7 w$ u3 S2 D5 q( O! e; c. t* |
var pausespeed=(pauseit==0)? copyspeed: 0
- K! C3 @& \: {7 C8 |2 m( q* v2 Dvar iedom=document.all||document.getElementById
* x& R- g# n9 I( e3 Rif (iedom)
3 l( b# l( b* v$ ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
S; ]# S4 w; L2 @var actualwidth=''
& R6 F$ X3 d; r8 D+ y+ s" \var cross_marquee, ns_marquee
# O d/ K5 A' u& _
4 ~1 B: J" n. v9 t+ o. F0 ?4 afunction populate(){5 {( q- B; M/ i; W! ~ N) s* W
if (iedom){
6 c; d3 H1 I0 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' V! S8 `4 d8 v! vcross_marquee.style.left=marqueewidth+8
8 h) C) I# ~1 fcross_marquee.innerHTML=marqueecontent2 R+ w, v; t0 O% x- a! c2 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% {' \( x P5 O! S e) [}
7 B( S9 R5 {8 x6 Q9 |3 d% Pelse if (document.layers){
& [1 ^8 e( {3 s0 Z- b5 G8 q2 Sns_marquee=document.ns_marquee.document.ns_marquee2' s. |3 X( f2 f @9 L0 \+ N
ns_marquee.left=marqueewidth+8
; e0 {. e5 G: v8 O1 r/ _5 H# Ons_marquee.document.write(marqueecontent)
$ `; q; v6 n; N$ A& ]5 C" ?ns_marquee.document.close()
2 K5 K( ]7 v- V$ Bactualwidth=ns_marquee.document.width
) u4 |/ U3 h3 X: h* p, F |}4 N( y# W# L, C' r
lefttime=setInterval("scrollmarquee()",20)3 x9 g4 D" M1 S7 \$ ]
} w: t Z. L: y4 s; V
window.onload=populate5 b) V% l8 w9 h% ^
+ ?( K5 H* l8 O* U; e# |1 n
function scrollmarquee(){
+ n- W# Y- N' D( Y& N J; d4 kif (iedom){
4 _7 U" ?. i9 f% tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 T! J4 y* T- l' g. R/ fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 R" h. K0 x1 O4 ~; B- k& A* E
else) [ N1 t5 e# M3 v) f
cross_marquee.style.left=marqueewidth+8
E, l% g/ h8 P ~$ L* M0 O7 o& ^; I9 T
}* j/ l( J9 Q& C3 o# Z0 J
else if (document.layers){ f" W* T: h' k& Z
if (ns_marquee.left>(actualwidth*(-1)+8))7 E3 N) E+ {4 O+ s% F
ns_marquee.left-=copyspeed
: E& }! F9 ?0 ]9 c, \8 Kelse
! F+ E, w6 a- v. j; o7 kns_marquee.left=marqueewidth+8
# t2 I9 z" [( T$ M. h6 F5 V/ G9 N}& L8 f5 C z* o! e7 T; m6 b- t
} \5 |# r* y8 M
! s6 X( ~+ b' c
if (iedom||document.layers){
* d7 l0 O) G6 X2 }" ewith (document){
2 B' B. c0 L: J/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ e& `9 p. ~3 M, ~if (iedom){
0 }8 W V" c# F% M: P# c! }0 F+ Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 b! t/ G, Z) Q6 ]. Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* Q. y$ G6 H/ n; w- Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! c" ?& z# O9 Q/ S: Y
write('</div>')
0 \6 b0 l; T8 K2 _; i+ X}
1 E2 i7 l$ r- G; |4 ^else if (document.layers){
0 G( O4 z2 z/ V4 o% m0 _& Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! ~* }9 d( R9 {7 lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 H, u# q# A+ L/ k3 _" y3 L, J
write('</ilayer>')) `$ C z$ f4 Z+ R; d
}
: Y8 a% n' w# f5 V- ^document.write('</td></table>'); O: V* H! P3 m6 g& \* X7 u9 C' V! G
}
; f# r3 T# z( q5 S}: d: g, @. y, }$ ^7 a" D
</script> |
|