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

|
网页之跑马灯文字特效
//修改宽度
8 C' [% L, V8 ?var marqueewidth=300% |' `* j% ]" C
//高度* M9 O* e* { O, r
var marqueeheight=25: ~2 { Y, j* v% d* _( U) A
//速度(1-10)6 o8 j1 y8 q! K+ L* E) J/ e- P
var marqueespeed=3
: r# L+ C5 P/ i2 T% Y: S. w; ^//背景颜色$ C* }) S! Z1 ?7 m* Z+ z! K/ U0 k
var marqueebgcolor="#FFFFFF"1 Z1 s- P, J' g y
//是否能暂停 (0=no. 1=yes)?
# f* Z3 n) Z6 m }: Tvar pauseit=1
& A* u3 i* w$ f$ |
# Q: W% u& w. i) i# [4 X" U//修改显示内容
J- f% q0 g4 h, e7 m* ~. k/ Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 b b2 s# z5 {( X+ q
) e4 c- G' @$ b
/ o( X, s& g9 W////下面不需改变////////////( ]" c* ?4 m) P) n5 g+ n. l% Q
) U _$ X; w- n) u; w+ j& t) Ovar copyspeed=marqueespeed. H9 m% a5 ^7 {* k; u$ P/ B0 `
var pausespeed=(pauseit==0)? copyspeed: 0 c# ^7 v- ?8 `! V/ y& o0 D5 \
var iedom=document.all||document.getElementById x; S2 ^1 K- j; Q& G) n2 C4 F
if (iedom)- p3 J6 L+ ]& S2 E; H0 M* t$ S1 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 C/ p7 d: ?' L. R+ }- B# X
var actualwidth=''2 ~/ c; ]( n. p ]' @* ?; f
var cross_marquee, ns_marquee8 ]- j/ A3 y! V- `5 J1 \% U
0 u4 ]1 H1 _$ G, P2 a( A/ f/ {4 Jfunction populate(){
( ]& i% \% T- p H, e+ }5 ~if (iedom){' T3 y5 Z% N! z) U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* \ T; g( V+ \) W3 {6 H) n' S- rcross_marquee.style.left=marqueewidth+8
7 `0 W0 u# _2 u' Pcross_marquee.innerHTML=marqueecontent
9 Y& u; I) B5 m. {, |' Q% jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- c% G; b! ]- n$ L
}
7 j! N' N- Q4 {# Yelse if (document.layers){) _; X6 ~$ R' _6 V \' c
ns_marquee=document.ns_marquee.document.ns_marquee2+ @. d6 m2 J% G
ns_marquee.left=marqueewidth+8
9 m* Z+ u9 R; o. m0 Y& Pns_marquee.document.write(marqueecontent)
, R# b1 Y7 c3 h+ Ins_marquee.document.close()
/ d" ^+ Y; l2 u) U& ?# Sactualwidth=ns_marquee.document.width
1 {% v, A# B7 d9 q1 P}* u {% u; N1 Q0 o' w S
lefttime=setInterval("scrollmarquee()",20)% M3 B$ M, P/ ?, W$ w
}
1 ?4 T' _6 X# vwindow.onload=populate
6 a& \7 a9 z! h# n& v Z: |
+ ^. c0 M7 N/ W. A; g. r0 j# Ffunction scrollmarquee(){8 ^% i5 o9 j# t+ `0 X0 j
if (iedom){ W7 ]4 ^* C* o# y( T; n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 U% @" Y$ o* K3 o; r M: K2 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. W2 l2 w. c/ Ielse
1 l: o+ p7 ~& R* b3 ]3 e) Ecross_marquee.style.left=marqueewidth+8! }1 n9 Q Q: Y8 _+ s: i6 T1 l
- Q: V4 k% i7 Q2 w/ ]3 S- q
}
. E" p% y3 Z, welse if (document.layers){
7 R" x& S# ]3 |4 f7 Fif (ns_marquee.left>(actualwidth*(-1)+8))
' N6 o: O) t% {) K; {( k4 Mns_marquee.left-=copyspeed( i7 o$ R6 C6 F; S& V1 Y! `! S
else
3 ]( M9 B9 ?- i& B' Ans_marquee.left=marqueewidth+8
) M" G) {3 W. p. Q% w3 t5 Y& x}
2 f O) B8 b/ z}
5 N; X, @, f& q& Q$ z- U$ m5 d- U$ N3 m0 h" c( g' S
if (iedom||document.layers){
f3 U) Q* V9 R/ X$ A6 p( r. Lwith (document){) k, N8 C) }1 H! s/ f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 y/ a8 l0 ^2 t! Y# eif (iedom){- o- n5 f+ A3 Y& ? V* t8 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' z) D/ X5 [# }* r% P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- N, c; q- a$ X+ B' T7 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% V% P' ?; j* Q3 c. s1 Nwrite('</div>')
3 W/ I5 O$ e1 q7 b}
$ R8 \: r# @8 V% B2 e# O6 j% R% u- Zelse if (document.layers){
" f0 W9 \! V& W G$ h0 O& s3 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! ^) [5 i2 K. _; H# k9 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! u0 x! F9 Q3 Z. h7 ^* o
write('</ilayer>')0 ^6 r2 q3 {3 B! u
}
8 ~7 W' |2 A% G1 Bdocument.write('</td></table>')
8 t( K, }1 A6 C0 K8 Q5 q}. M0 x" D! ]9 n6 m8 f
}& x5 Q0 `) ?$ p2 B
</script> |
|