返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- S+ {' _' Q8 U1 W* Hvar marqueewidth=3007 }- O( p3 ^& D4 |( j
//高度4 o8 P4 P/ k/ F5 t) }
var marqueeheight=252 ?3 l) m- }- J8 \
//速度(1-10)
5 B0 d, w! R+ ~: I  `! Nvar marqueespeed=3
9 g, P+ P- K  P1 \! p4 r//背景颜色3 y- ]3 P8 W6 Q5 X
var marqueebgcolor="#FFFFFF"
* {/ V( w$ s1 m2 O  [( N8 T5 T! w//是否能暂停 (0=no. 1=yes)?
2 t4 ^% L' B* d: Z& Q  p" p/ \var pauseit=1
: L1 x: j$ V$ [* [3 f. Z" E5 q; }+ y1 S6 T8 b
//修改显示内容
1 A& j) s7 P- ~: c. avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 D$ k1 c/ z$ i5 s+ ^4 t
: d( {# @0 e, H; w* _' X& V4 u1 A
$ a" @, s' L8 h* h/ r////下面不需改变////////////$ H$ y: B; A- B7 _: b5 A; C
9 y& Y/ p, t- g! U. M; T& x! o3 f; g. I
var copyspeed=marqueespeed
5 P9 _( N) `' Dvar pausespeed=(pauseit==0)? copyspeed: 0
) b0 w" {0 r% Z$ j- Z. D6 K4 Avar iedom=document.all||document.getElementById
/ s- w2 o( X1 P" P; \7 [/ L- z2 l7 T' p% r3 iif (iedom)
" P6 }5 d  d6 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- i8 F: \1 }" [4 L3 k# }' \& b  x& ~var actualwidth=''
+ p4 _% t3 B& }2 o9 l9 z2 `var cross_marquee, ns_marquee( k* U; _( B$ ]
/ R6 C( z; f( f/ ^' x
function populate(){
6 D4 D1 X2 S1 u/ {6 _& ?8 ^if (iedom){
3 {- @! U# z5 S3 L9 Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, P: ~" _, o" ?4 I- I$ Mcross_marquee.style.left=marqueewidth+8! Z$ L0 l, v( t! B1 c
cross_marquee.innerHTML=marqueecontent
; ?; S, |5 f; G8 \; }* }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" S, Q7 P  {) ?}3 k8 A9 o% a, {
else if (document.layers){
! H  S% O( J3 t9 S& x9 Dns_marquee=document.ns_marquee.document.ns_marquee22 ]: }7 O* P$ L# L
ns_marquee.left=marqueewidth+8
, a2 g+ ?0 J( ?9 Lns_marquee.document.write(marqueecontent)
! q, F3 b/ }- ]& ~) |- |( Q# ^ns_marquee.document.close()
- C. g. z9 S. r+ w: Dactualwidth=ns_marquee.document.width! o3 T. e1 x3 ]' f# _9 ~( d+ s& ~
}
, i1 [, K+ Y9 Z3 Y8 clefttime=setInterval("scrollmarquee()",20)
6 `) b. w& x) p  i; i- x}& @* Z. J0 r- [
window.onload=populate
8 B' e1 V, ?! S: m3 `
. h' u4 {6 o7 |( t* D3 @! H# wfunction scrollmarquee(){9 ]1 ~8 n% l" C
if (iedom){
8 F  i9 z1 b$ }8 r: x6 ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) E1 x! ~5 B9 H$ a: `, c3 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. |7 i) z, y" [" A8 s9 ?3 m
else
+ u/ ]  v- B9 q. S$ icross_marquee.style.left=marqueewidth+8- j6 a8 K* \! U9 N

# I4 `7 n7 ~: |# U" b}
4 r$ l8 K! j6 s9 `% a+ Gelse if (document.layers){* P, `  n( l8 E
if (ns_marquee.left>(actualwidth*(-1)+8))
. G6 b& Y# x: N" _ns_marquee.left-=copyspeed
' T" R# x; b( x" a. helse
3 z9 ^: M3 w8 {ns_marquee.left=marqueewidth+8
+ R0 i# N  ^6 o4 v}3 w9 W+ b9 u7 P, \8 W" Y% u
}
( q* i6 U( G3 m4 A4 F6 w- i& y+ a0 r
if (iedom||document.layers){; Q3 ]/ N2 O, o# l" |
with (document){
$ i4 O) i3 Y$ _; [/ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) ]$ S  I* T3 m) C' t) w
if (iedom){& G. H1 A0 @% Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" j- g/ U. |6 E4 {2 Y+ V; L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); V; B. g, a2 r2 z- T9 K7 k6 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- N5 k% L8 Z7 v& c4 i% \3 C5 R) _write('</div>')
1 `1 R) t% d, d: X$ u2 {& w7 \/ E}% e8 P( _# N; |1 a! p' s- C
else if (document.layers){3 P; s2 I3 f$ g8 M1 [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. s, \3 W0 T$ |& Q$ Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ~! x, w! j* H, p" P, G
write('</ilayer>')
3 h8 @0 }$ c# q$ x& \}
& S$ F1 R$ f- A+ M( q/ bdocument.write('</td></table>')
9 c3 h: N- d/ t4 G, u}# X/ S, a3 {" c/ ?6 l, \
}
2 c: I& }- O+ p% C" o2 |</script>

返回列表
【捌玖网络】已经运行: