Board logo

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

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

//修改宽度
' r, O3 i0 ^4 u4 ?7 o- Evar marqueewidth=300# l3 s7 l8 i! s+ B7 [
//高度0 j1 Q4 W/ m$ N0 A( G) ^: C% f
var marqueeheight=25
/ x( `5 B8 E  @: q//速度(1-10)
' i: R# g! C; G3 wvar marqueespeed=3
" X+ c( B$ t) [4 w//背景颜色6 j! x8 N2 n5 ]: y) b0 m
var marqueebgcolor="#FFFFFF"
  G- c6 m5 w3 S0 O' P//是否能暂停 (0=no. 1=yes)?6 ?; ?9 l5 }' W5 a% Y" Z
var pauseit=1
& h! R2 F+ ?* S+ F
! r$ l" Y- X6 V' c  q$ Y5 R//修改显示内容! e& B' B; T, a' x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# Y* k/ t3 C* r6 J
4 E- h; N- U. {8 }$ P
2 O; n5 G( Z8 h" V////下面不需改变////////////
& e0 s1 d0 {" c7 W. F3 U  ]( O' N  J2 v6 B+ L6 p4 v2 I
var copyspeed=marqueespeed1 J$ s' _% l- M' ]) i
var pausespeed=(pauseit==0)? copyspeed: 0+ r2 Q3 n. }- `6 c# {" j7 A7 |
var iedom=document.all||document.getElementById" [+ w. h# y" I: o5 @1 U0 T4 q3 l
if (iedom)4 J( ^8 T6 A7 [3 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( J3 K) Q+ N5 g) v
var actualwidth=''
5 X/ D; n" p+ S; nvar cross_marquee, ns_marquee" ^' Y$ h1 \9 [( n1 o8 B! L
% U& ?. i) r6 O3 k' _
function populate(){
) Q# z' G) @, I$ pif (iedom){
8 o4 }+ O  k9 S) X3 D# Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 p) X; [- V, G+ V5 Z1 e8 Pcross_marquee.style.left=marqueewidth+8
* Q1 k$ E9 h% S0 Ucross_marquee.innerHTML=marqueecontent! d! ~. y: b* ?9 m9 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 P, b1 U8 F( X  G6 @/ Y}5 j; p0 {$ t& f, \6 C* i" c) t
else if (document.layers){6 p7 j/ Y' d: }* }
ns_marquee=document.ns_marquee.document.ns_marquee23 {# c+ ]+ I# l/ q. Z3 z
ns_marquee.left=marqueewidth+8: j/ C2 Z6 Y% B. U3 I) e, M/ b
ns_marquee.document.write(marqueecontent)
: A( _' L4 r( q; i6 C4 M) Z& \ns_marquee.document.close()
+ t" O$ M2 v* G' [& _5 ~actualwidth=ns_marquee.document.width6 `0 w$ V; y( H/ @) e. k' F+ T
}
- j2 X( Z3 N8 ~. r' F/ n6 klefttime=setInterval("scrollmarquee()",20)
2 |  Y. H( ]+ c9 m; N2 L4 t8 g}
0 j, h2 z3 ]& E  o* Q  u% k6 Rwindow.onload=populate
: R, u/ t8 E6 b+ R
9 u0 @& a8 A8 ]function scrollmarquee(){
% ^, z9 S0 U* G$ t- m% sif (iedom){7 R8 V2 e- O( _- ~& K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& F8 n) D* L$ }, Q3 t* @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# s! c: G5 S7 X! ]' D2 Q, P7 W8 helse
  ?9 y( N3 n/ [. Icross_marquee.style.left=marqueewidth+8* ]; g8 U4 [1 `; n
( Z7 d0 I! [$ o; i! A; A1 |
}
+ O$ g# W% j% r( Pelse if (document.layers){' Q5 Q& ~5 W6 Z- e$ _* E! c
if (ns_marquee.left>(actualwidth*(-1)+8))2 e( \; X& g' c' d& J0 N$ t& q
ns_marquee.left-=copyspeed7 a5 G# v7 v' k4 B
else8 h7 N, m" [) W1 p- p- P; B3 G# y0 a0 N
ns_marquee.left=marqueewidth+8
* S2 z6 x' ?, {$ ?& g}' Y7 G6 @5 A0 |. Q
}) O, ]4 d) ?3 @( ~

! s4 K, [' W+ M5 U. r6 `if (iedom||document.layers){" `' Z# [- X# H
with (document){
8 H+ {/ r7 ]3 m9 {8 [. Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); G" P4 e  `- `# |8 u' b4 ~
if (iedom){6 ?" C* z4 n4 T4 h1 h( h' A: U( S1 k& S) U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 {; V! S5 i6 p# L5 `8 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% k/ o. ~* W$ O/ V" z$ @# bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 s. [8 q* y: |( S, ~write('</div>')  W5 x- k; Q& F% B# }, F
}( o+ l/ _$ `5 G4 C+ Y
else if (document.layers){  f% f1 c  [2 r. J. f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, x: U: \; |& D) K7 w) M! @% a6 bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' M2 h7 V) P8 C4 \; P6 z
write('</ilayer>')
: V- G/ k1 B; q}) r/ u  q( J+ s) ~/ x- O; H
document.write('</td></table>')
" A- L, y! J$ E) v* ?' l+ j. j}2 J' s4 x/ w: F
}
1 w* n/ K, [8 t1 t4 n</script>




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