返回列表 发帖

网页之跑马灯文字特效

//修改宽度% `- o. J6 Y% ]
var marqueewidth=3008 J- D5 ~* \; p  z# p
//高度7 V# ~4 C5 U, ~" }9 B
var marqueeheight=25
5 @9 G2 v, [# q//速度(1-10)
" p( t" s( Z* r1 U2 v3 }var marqueespeed=37 y3 |  S& k  p* {
//背景颜色  u. y8 U. t2 g# i
var marqueebgcolor="#FFFFFF"
% k, t* g' b- O; W" d$ h//是否能暂停 (0=no. 1=yes)?& ^1 {# h- J! N) @+ \. s
var pauseit=1" f3 ]7 z$ Z  \3 K+ _

8 p( g0 ^# Y$ o! v) F" e//修改显示内容
% @  @1 [9 [. H/ p0 S9 E; Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) f$ N4 V; t' S3 `
5 Q. U. h+ T9 Z. B. ?' I4 D
, d" E! B' l* p& A* P9 y1 ]////下面不需改变////////////
/ ]$ w6 L3 S- i# b, t
" B- t# {1 b5 y$ Svar copyspeed=marqueespeed
; T, q9 ]6 P5 P5 p5 z! \0 x( Bvar pausespeed=(pauseit==0)? copyspeed: 0
; m9 y; J7 ?& O, X- y9 Lvar iedom=document.all||document.getElementById
: ~( i; z2 q# l; P  N: xif (iedom)2 E& \0 M2 r% g( d2 E/ Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( L* {4 B7 O6 B' E$ Avar actualwidth=''" I! P( l0 k* w' a! l% @# `
var cross_marquee, ns_marquee
: E2 f9 _/ o5 K
2 W; z% r2 @6 [3 {1 B( Ffunction populate(){
# a' j5 x  q8 d+ O: Xif (iedom){9 N' E' S$ g# S0 ]% |3 o$ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- Y: n, W4 B! G' m* Q5 u* hcross_marquee.style.left=marqueewidth+8
3 K. {6 Q  l6 S2 r1 l4 hcross_marquee.innerHTML=marqueecontent6 Q) ~4 V! P7 ]1 [7 J/ W; v/ j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( t  @; O% S% G5 T% W0 v5 e: \! K
}
* A: G+ G4 _$ P$ q6 _+ telse if (document.layers){4 m6 a% J  t" G  w3 Z& \) X
ns_marquee=document.ns_marquee.document.ns_marquee2
- ~4 ]6 T% R! o7 y  B' Pns_marquee.left=marqueewidth+80 }5 B2 V  Z/ Z
ns_marquee.document.write(marqueecontent)/ M2 a; I9 \- G! k8 _4 H
ns_marquee.document.close()5 S# y. X0 E1 f" W/ D
actualwidth=ns_marquee.document.width
, j- n0 M9 \! }9 ~}
0 c) j* p4 }2 X  R& q0 U9 ylefttime=setInterval("scrollmarquee()",20)
; @) h2 z% \* h* ^5 L}
0 d" X% v* C' T& b1 |/ e! `window.onload=populate
& ^  j% `2 H. m5 p: F+ p
, t! i, E9 x# nfunction scrollmarquee(){# _) i( o, z1 Z+ }+ A! E, K
if (iedom){
3 K$ F( a" P: ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' c8 }" m( M/ F% H1 w" b0 {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: K% T' A: }) b7 A1 y- ?else
" J# f, u1 e: u$ j1 Vcross_marquee.style.left=marqueewidth+8: n6 }. B- w0 W: e

7 p7 D: }  k- d; i4 z+ x* ?}
+ J+ n0 l6 ^; n4 o2 ~* K! K0 Z" welse if (document.layers){
2 U2 |; E4 C, C% Vif (ns_marquee.left>(actualwidth*(-1)+8))
. a5 B' H1 }. |. j* ^ns_marquee.left-=copyspeed0 O- T  q4 A0 ?6 O" S% Q# l6 c
else7 x5 r/ ]1 b2 X+ l
ns_marquee.left=marqueewidth+8  d' a: @: F2 _/ x$ h4 _1 J
}/ S/ |1 G% G/ k7 U# {" _4 _2 k
}
2 @; C4 l( k5 F3 L% d2 l2 U- p$ g4 f; ^; _8 ^( b+ R. v
if (iedom||document.layers){
; ?7 M. ^& P9 A+ _* u3 ^: bwith (document){
) ^9 ^0 u7 v3 V- ?" t3 `/ ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ @1 I$ I' G  P
if (iedom){  ~5 ~1 Y/ A) z0 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: F2 A, E! M& k2 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 q- P5 S0 O6 o# D/ B* ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 _- R7 R# v/ @# ?* dwrite('</div>')- S& ?7 F/ A, |& v% d& r1 H
}
: W" V6 Y4 h3 u: F* s, R. z- D) oelse if (document.layers){
# [7 j) J7 K# Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 w. B* |( P1 o+ ^1 V; awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. i$ U# J' I3 S" D- Swrite('</ilayer>')9 R0 Z) o2 ^  s. b0 d3 U, b
}' f) v( Y) ~7 B- x4 S
document.write('</td></table>')
) p/ I, H7 @, S1 X+ v; m}
9 M" H. A+ C" q: @0 Q$ A8 M9 r}' a8 C+ j0 S! c9 n- \3 h
</script>

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