Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度9 r/ p( [( v* ~+ m* S1 N
var marqueewidth=300
6 j# L; l3 ~1 M) t0 G# n( j" H5 f0 U//高度5 c8 p* a3 x& U- l6 n2 T+ b3 l! ]
var marqueeheight=25
( J8 ?7 [, D$ M/ P; F//速度(1-10): ]! K' Z& [1 t" s7 D6 t# n
var marqueespeed=3. r8 ^% c9 O# n7 _1 D) _+ I- K
//背景颜色, g8 `, H& H2 o. A) R
var marqueebgcolor="#FFFFFF"% h. i6 {0 v5 |  @4 |7 {
//是否能暂停 (0=no. 1=yes)?, ?1 r# z1 _9 Q0 {* s# Z
var pauseit=11 J: ]6 r# \+ |7 j! H& c

, t. _: E2 `& G" g! s//修改显示内容' L1 z) z" g# r' C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! f' `5 g! B/ V; x- N0 y" M8 z
. J) J0 e6 I9 j0 M" W1 ^+ J; m1 b7 |

8 x4 V! d" E' T5 b////下面不需改变////////////
/ G) ?7 S* o7 `  |" [
8 P% Y) U2 \* v- o+ m3 F# a, ?var copyspeed=marqueespeed
9 K& e# j* J, f8 rvar pausespeed=(pauseit==0)? copyspeed: 0
* K8 B4 d# d) x: Pvar iedom=document.all||document.getElementById& F6 ]: w' \4 Z3 _% y" c
if (iedom)
: P  q! d, H# L  Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; Y1 h0 ?$ r5 s) lvar actualwidth=''
' _* m( Q, g$ ~/ L6 d; G2 S7 v$ Mvar cross_marquee, ns_marquee& C$ q' b% D5 _7 f6 w

4 L% c. K0 M7 w# Ifunction populate(){
# c; O+ h1 C0 x; uif (iedom){7 `  M8 N* w0 X/ W2 G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. E. Q  l1 e! D4 ^% B
cross_marquee.style.left=marqueewidth+88 U- g- j! N, g# Q
cross_marquee.innerHTML=marqueecontent8 W5 p1 g9 j% o- B, f* h! ?4 m% T% y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( @7 V7 k0 f- G6 V" h, x6 V
}
! @" E- a1 b) _( t1 Uelse if (document.layers){
4 p5 \' h& v1 K( i7 ?- qns_marquee=document.ns_marquee.document.ns_marquee27 O# x1 n  l" k5 L5 y
ns_marquee.left=marqueewidth+88 w# c) F% O# `
ns_marquee.document.write(marqueecontent)2 f  P$ c2 q+ ]2 z* J
ns_marquee.document.close()+ a4 |. R) p$ ~0 q3 {
actualwidth=ns_marquee.document.width- H' x( u! r6 C" G
}
! l( p% k" P" v5 H) {lefttime=setInterval("scrollmarquee()",20)
( F- q& W9 f! r/ D}
7 S4 M! A4 m. J1 Bwindow.onload=populate9 P9 t" X  p! e9 E' X" i" S$ J* o

7 q( Q8 m5 g$ u( f1 M2 S  l0 Lfunction scrollmarquee(){
- `# ~6 g: G' `" Iif (iedom){5 M' o. c. m5 @: Z/ K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 S1 f4 g8 _' X+ ^/ ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. B  _; m$ {4 j8 x# W* E. Qelse
: e/ \- r4 E/ W* `. ], M- g( }' Lcross_marquee.style.left=marqueewidth+8' \- }. E6 V1 Q2 w6 u$ E7 Q/ E5 ]

- {# R; ]" h( H( t) Q8 u}
, L& [* _) c: \6 @- D: ]8 yelse if (document.layers){
  J, D4 }6 [! E0 X3 r4 Iif (ns_marquee.left>(actualwidth*(-1)+8))
. q  o, `$ Y: s3 j! Yns_marquee.left-=copyspeed
1 L4 C4 Z- U, I4 `" m  I9 Xelse' C4 @3 h1 m# j0 f; G' I
ns_marquee.left=marqueewidth+8
, @$ E. f+ U7 c3 h4 y# L: q& H}
" Z' R9 ~& O9 w/ E+ N) l}
0 [$ `! k+ H- Y- D, V5 h2 B
, s! i/ A" ~/ x3 |0 U9 F& `% Cif (iedom||document.layers){. F5 j- k! \2 y
with (document){
% S) G: a  c; hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& A/ Q, K% A6 G# J$ x
if (iedom){+ ]; Y9 t2 E' i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 t% o, a! U. r% E/ S% fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. j% Z1 S+ _- t) b! j. ?9 X* ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 i1 R: M/ C, f) k( _
write('</div>')
* k: |, U, a7 ?; i}& ^4 S; j. b$ I$ f% M0 j
else if (document.layers){
( {( i- n1 b" M5 i3 ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 ^3 `3 ^2 i' i; {0 k$ f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- n! e; B; e6 k
write('</ilayer>')9 u0 A9 Z% w; t+ V
}1 P) z% ?3 P% S# B$ W
document.write('</td></table>')+ w6 ]; F7 h" C4 ^
}
" b5 O+ |- J4 e2 `7 ^}
& U+ {0 |+ \2 \# P3 e</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2