返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 [* g9 v/ w- O+ l
var marqueewidth=300
  a3 b. E1 |4 h, W//高度
; Z6 H: {$ i5 \) I  ]- |var marqueeheight=25- R1 d3 R4 d" j& s3 b
//速度(1-10)2 g" k4 o8 g# s" S4 ]& k; Q
var marqueespeed=35 F/ \5 H- O" Y0 T$ o  W9 l, A
//背景颜色
! m8 i. O- M& f- @, o. ]var marqueebgcolor="#FFFFFF"4 k6 ^8 S3 D- i9 }& m, p( a
//是否能暂停 (0=no. 1=yes)?
+ \6 `) E# f/ s' gvar pauseit=1' h2 \: f3 C/ d2 ?
7 n1 a. b2 z* z4 [
//修改显示内容
3 t( z4 H( P/ s/ G5 B8 v5 N+ h" @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) A1 ^% j7 O& R, h
) u9 }# j' \) g0 W6 g3 g+ \! D: |" J+ X2 u. v/ `8 f# R: g: Y
////下面不需改变////////////  M% [; T1 }9 Z1 s2 a$ O6 @7 k) @- t  ]

+ H# J: C& H3 ~3 P( u/ F% L0 mvar copyspeed=marqueespeed7 n# ?* H5 T! H8 T4 S! B
var pausespeed=(pauseit==0)? copyspeed: 0( G, J) x9 l: o$ s" _
var iedom=document.all||document.getElementById# Q7 o0 j1 U  T0 ~- d$ q
if (iedom)
! a( ?9 N* j9 U5 n. A) Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: z+ q- H+ [8 L% U6 c' ovar actualwidth=''; |, F3 L& o" b
var cross_marquee, ns_marquee
9 {* w! I5 D# c  {  [/ a
7 S  B8 m4 ^4 q- gfunction populate(){$ r  Z0 S/ A1 F
if (iedom){1 y/ T- k4 _1 E) {8 A1 q4 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' ]) V) N  m# L. c- tcross_marquee.style.left=marqueewidth+8
9 B: F1 \1 v) ?+ E0 `# Z; mcross_marquee.innerHTML=marqueecontent
& \9 D, d. h- }6 q) x' @; n* A* iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( f; H9 w9 G* l4 \- V. @9 \8 N5 D/ p}
8 `6 @/ ^' }& belse if (document.layers){
0 J8 `, u3 ]5 Z, f9 Y' l( mns_marquee=document.ns_marquee.document.ns_marquee2$ B; a# |8 B5 N6 S* W
ns_marquee.left=marqueewidth+8
; F. [# {! M9 K( |. Fns_marquee.document.write(marqueecontent)/ w" x- \; L  Y- J0 B
ns_marquee.document.close()& d, M' _0 T/ M! F4 t7 P) J# Y
actualwidth=ns_marquee.document.width/ Y. |) g- m7 R3 g6 ~4 |6 B
}
! N5 ]) o7 `! A4 p; z9 _; ^lefttime=setInterval("scrollmarquee()",20)) J) M  W3 E5 v( d' d
}3 a: O5 i; z& k% U- n$ H
window.onload=populate
2 {. N$ y6 j) C* E+ V. g
+ I! Z9 k, ^$ ]8 L+ D6 R. ]: Jfunction scrollmarquee(){
+ D) e& h4 q+ D1 Uif (iedom){- H5 J0 @! f7 N; t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 p' ]; i: W! r" s! A0 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 e6 w! q3 Y: }! Yelse3 s0 p/ S4 S7 H2 D# |4 p" j
cross_marquee.style.left=marqueewidth+80 `% c! |+ S- W% R! B; q
) P3 }( A' O3 F
}
; [' r3 R: V7 q+ welse if (document.layers){! t5 s) j+ Y5 {; H0 R2 h3 b
if (ns_marquee.left>(actualwidth*(-1)+8))9 q1 b# V! {; g# r: I; x, ^
ns_marquee.left-=copyspeed/ [. a* j. S9 p) ?; K/ ]; X
else
: O2 b: P$ w2 M' O2 ^% o$ Rns_marquee.left=marqueewidth+8
, V9 f5 O* f% ^% i% }& T, m# {}
2 }2 G+ T8 n2 r' O, q: f1 C; w}
& K; v6 X, O; F, V
/ K- }3 D% V- ~1 t" Zif (iedom||document.layers){
& n, d" g" q9 T1 U% n% ^& B/ Dwith (document){5 M4 \" K. b& d- Z+ D2 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 a+ L$ V; X0 S# @' r+ Q& y! Wif (iedom){
" y: Y3 k' m- I  cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 P) B( E! S$ V9 W; f% a2 w3 U/ X8 e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 J3 d! Y  y- Q/ J5 _4 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 A" h' v5 s- |" {  c1 p5 Y
write('</div>')
4 M. q: j5 q& w3 d  I}7 H2 {1 z& R6 _4 D# W3 [( p$ k- O
else if (document.layers){0 }: {- p: ?5 O' V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# b6 l2 ^& B. D/ E% Y3 A* Z4 a' H  Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 q! K) }% w1 `: Jwrite('</ilayer>')
! r, F; U1 M" D3 ^: n3 \}+ ?: {- s; V4 y  ~9 a. R
document.write('</td></table>'); G( p7 j6 }8 ?# u0 Q6 j
}
7 J' T7 a4 }  z  ?}; q5 d' Z" I! c! K7 H& h
</script>

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