返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 u  `: H; F" J+ U" m
var marqueewidth=300$ j, }2 S* x# R5 [9 z" C7 V$ V
//高度
) K" _& W; ^9 g3 m' k6 b/ avar marqueeheight=25
1 t8 s- u* S7 o1 P//速度(1-10)- R6 D, P) l; u
var marqueespeed=39 v" ~# O7 e8 X
//背景颜色
9 ?# }$ N7 e$ o: nvar marqueebgcolor="#FFFFFF"  m9 X/ w) |" f3 f; |
//是否能暂停 (0=no. 1=yes)?
+ H( \# N# m9 Bvar pauseit=1
* R6 ~) [  S% I
6 W/ F& l% F" m: h+ k7 C//修改显示内容7 u. L; |7 b) F3 Y8 f5 U* J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- n0 A9 \$ ~- {+ T5 S9 S! l* }) k3 x2 B) S1 q3 Y( D% n, c% o

: q. n! ]/ q$ a; b4 k0 u////下面不需改变////////////7 }2 T' c7 ~: I* B7 g
+ L3 r" A* T: J4 v
var copyspeed=marqueespeed1 t) M; P+ x1 ^: e+ j
var pausespeed=(pauseit==0)? copyspeed: 0* a1 D* _! w- j" D5 g0 g7 f, a
var iedom=document.all||document.getElementById
' `4 d: r+ ~& q- k0 R. Uif (iedom)# Z$ e" R' q* k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 J7 k( }5 |1 C/ h3 i7 Lvar actualwidth=''
+ `/ H" W% s' W, }' Vvar cross_marquee, ns_marquee
3 [5 W# J+ n( G; l9 `  J3 @! N( I7 n' b) C
function populate(){; z- e/ U& Z+ |7 t3 C" Q+ h( f
if (iedom){2 O5 n  e- ~* {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 R' w" L9 `7 R6 n# j& ]9 g4 t  _/ ncross_marquee.style.left=marqueewidth+8! j( C% E: l2 x( s$ t0 k/ Y' u6 E
cross_marquee.innerHTML=marqueecontent& s, J& G3 C6 a, M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# L0 S1 W. _9 U: B) F+ L" h
}
4 O7 P! ]* s7 Zelse if (document.layers){
' {6 |% y/ F9 \) @  h( pns_marquee=document.ns_marquee.document.ns_marquee2
) `) [0 G! C7 h5 g  I0 Xns_marquee.left=marqueewidth+8! Z9 S8 s' e! @9 E5 \% {
ns_marquee.document.write(marqueecontent)2 _9 q* ~& S; {  \
ns_marquee.document.close()3 _0 T) c; n8 Y# n( z( D
actualwidth=ns_marquee.document.width
8 p* L! N( }$ m) Z' v}
: \7 O3 [" p2 A- }lefttime=setInterval("scrollmarquee()",20)
- B& I1 t" v7 z/ A0 o}) N9 ^. y3 c1 @# o$ M) o* b$ g
window.onload=populate2 h1 @, X: T# s- L

' D* r. W% T: ?' y9 a; f- x" Ufunction scrollmarquee(){
; k( o8 O: t/ F6 ~$ |2 ]if (iedom){5 i3 P7 E  z' n6 s, T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  T0 \% S) {* j2 o, W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: n0 G8 l: |" ?+ U
else
8 A" N$ P; \6 L4 t5 u+ O& L: g$ u6 Mcross_marquee.style.left=marqueewidth+8! q5 K. O; A, T9 L0 u' C
6 n7 }! m4 A' R- L
}
, M8 R3 O; x5 E5 |; G( R6 zelse if (document.layers){
. v0 z" U2 e( r. N- T' B5 z5 ?if (ns_marquee.left>(actualwidth*(-1)+8))# @4 [" J7 q; U! {) g$ Y4 N5 `
ns_marquee.left-=copyspeed
1 ^( |+ w% s5 h, X" v# |" Felse
: @: O! n. i% ^% @# ~7 mns_marquee.left=marqueewidth+8+ {- l2 R4 q& D( f9 _9 g
}
8 y% a+ E- Z8 N; H  p}, q7 [& n0 u& I) P
4 G& K7 _& I4 b  t$ x; j
if (iedom||document.layers){
, J/ d' H. @* M3 c& G% D7 M9 Xwith (document){
2 Z! F1 y9 N/ l6 \8 ?8 ?3 edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ ]3 q8 h3 O: W' s+ W  Yif (iedom){
3 u# ^) _' O5 `5 s( d. uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- `! y; l& v7 o  [" W  qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! o4 f: a" q3 [) o" j( c' gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" p- e1 E5 y9 q- ?  U: E7 Y
write('</div>')
" V% N  z7 m9 B$ a5 b) @5 |}
3 t! p' d9 D" Q8 lelse if (document.layers){
' }. p* K/ J( V* Q7 E$ Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ Q! p3 b! X; B6 U. r/ z1 `* g$ c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! |- E6 I: ~- [' F% y- uwrite('</ilayer>')* w- D& V# {5 p8 u* |2 V
}
  |' [2 R- A+ |) N4 v2 pdocument.write('</td></table>')
1 _  _( a$ S! U8 x) S}
' h( c' C% T  ?+ v3 `# ^/ \7 O, R}
0 n- t: W: f- Y7 y</script>

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