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

|
网页之跑马灯文字特效
//修改宽度2 @& l) B' }# `
var marqueewidth=300" C+ B+ j- i; \& `" o
//高度* q5 z% _2 p8 F7 b6 L6 t
var marqueeheight=25
' A1 G# p2 e8 I5 u* q//速度(1-10)( V: B3 m# @! ]- d
var marqueespeed=3
9 o ?" T3 v1 m ?2 z, Z7 t//背景颜色
+ Q' g. R3 P. A7 M) Fvar marqueebgcolor="#FFFFFF"
3 l' c. I ~0 m, E9 ?7 T% i//是否能暂停 (0=no. 1=yes)?
5 v s/ ^3 K& H! S& ~var pauseit=1
% c1 g$ _# R b7 _: Y$ g% H4 ~4 { x* ] p$ d4 t- ?
//修改显示内容8 @2 {& w& f9 M: t6 n* h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) s* J# Y* e% B' o8 t k
! Q) b% B. ? V+ r' \. U! s8 e; k1 r q& l, n- z
////下面不需改变////////////
. j9 U4 Y5 [/ A, I5 ^$ R" V. O/ f6 J( O* A; C% Y$ L( J7 }7 P
var copyspeed=marqueespeed0 M8 F R9 `, i0 m5 I' V8 X
var pausespeed=(pauseit==0)? copyspeed: 0: [1 i$ T) m$ I) s* Z; l8 x
var iedom=document.all||document.getElementById
7 H5 \, |6 w0 eif (iedom); a+ W q: w4 ?+ u; P2 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
H) r; F+ H$ ?var actualwidth=''/ m0 Z& y7 Y7 `- r
var cross_marquee, ns_marquee
: M6 R7 B$ e6 C2 V) T- |9 M
, ~, u5 y. T/ p' }, Ffunction populate(){
: o* W" t& B0 [% O) Bif (iedom){
! w$ u( c w$ L6 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 r# L4 m w! M" C8 ycross_marquee.style.left=marqueewidth+84 m9 F' Q, k" ~% X3 p8 q
cross_marquee.innerHTML=marqueecontent0 k/ U- a* {8 Q2 K, V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: T! }3 c' Q, g# U- Y v; d$ m}: J, v. k( t0 ?+ s3 a- E
else if (document.layers){5 G: U6 o% s7 H9 {% V! A( q( O; u
ns_marquee=document.ns_marquee.document.ns_marquee2/ t; n" b$ n( n" S7 {/ K) \+ m
ns_marquee.left=marqueewidth+8
" q( ^& A/ v( @: D% B4 ins_marquee.document.write(marqueecontent)) X! g8 P( N, @
ns_marquee.document.close(), z% R/ s: X% w9 m" X0 W$ r
actualwidth=ns_marquee.document.width" S" C* Z( G; h7 |# |: C
}2 Z) K; `; F! z. T8 m
lefttime=setInterval("scrollmarquee()",20)$ C! q3 t! n4 [7 a$ z% C- W
}/ v! M: y; \2 w& u
window.onload=populate
3 I4 a1 n" `* l' \( F$ T/ R
$ V$ g/ j# @1 z6 S" T3 Vfunction scrollmarquee(){
9 x8 f0 |( h$ E+ Z2 _- tif (iedom){
Y q+ E% r# a* Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) P% q6 @ \- Z+ F$ Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* a k% E) Z6 Uelse: u9 q1 O6 E: M$ `4 r
cross_marquee.style.left=marqueewidth+8
7 D3 @# R8 m$ J" N: @# r' `
# U1 f6 r+ Q! l: D}1 |( G1 ]0 z+ F$ S& t
else if (document.layers){
# K5 R6 r; g( C1 l* v9 \, V" `if (ns_marquee.left>(actualwidth*(-1)+8))
1 H) ]# ?" M8 E" N0 Wns_marquee.left-=copyspeed7 f" s+ Q4 r5 O+ z
else
0 b$ j! J. i5 f. [ns_marquee.left=marqueewidth+83 `. U* D% T9 a+ ]( Q" N: r
}" F- H5 y# j6 q @
}
# W& e! S, h! q# D6 z: C+ A' C% p" I6 ?3 H$ Q+ ], E$ w
if (iedom||document.layers){/ n- y' X5 Q& a2 A U
with (document){3 R- k( p. F. ?* T( f9 p. `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, R- M" u) @$ Q7 a, R" c( iif (iedom){
2 \2 w( V* N: _+ n3 t& swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- v n# p1 Z* I- c0 ?' i4 Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# R0 D) J" m6 g+ \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
J# ]) @6 w6 I& f! U' gwrite('</div>')
0 [9 ~) o! p/ g( t! |}6 |7 x* }: L" t+ K8 [
else if (document.layers){
) \ `3 {0 C& n V' ]$ mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% ~: S1 Y) `$ c/ H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 {# Z7 x; z7 n2 Awrite('</ilayer>')% ?* n1 i+ d# g0 p* c% l
}; x4 x+ w0 j% p
document.write('</td></table>')! v8 w6 l/ m- ~, }3 g& M
}: ~, B6 k3 t/ D' u! T! ?/ R
}
: B' i0 P6 Z$ S+ O" ~3 v& u# t</script> |
|