|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度" u2 X" o: X1 N# K" y* H- e! d" n
var marqueewidth=300 f" Y$ X( {) n) w9 c
//高度- ^3 T0 C) `4 B6 W) j2 j j
var marqueeheight=259 l& }' J- z7 J* e o; {! g
//速度(1-10)8 ]- E$ ~8 d, Y- `
var marqueespeed=3" ^$ ^ a0 J) X: x+ K, ?' o
//背景颜色
& P' G n* \5 x( r& R0 x' kvar marqueebgcolor="#FFFFFF"" z; P9 M! Q8 f* ]
//是否能暂停 (0=no. 1=yes)?
) I3 \2 a, f3 Wvar pauseit=1
# f8 C0 z; D/ \/ n7 {$ w
! F6 D# g+ m) b. X//修改显示内容( B8 j- x# b) f% J3 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ h! E: j1 Y: P+ a9 u) P G+ A/ ^! q
+ H& q3 \ w/ O' `' I////下面不需改变///////////// d( h9 h7 [0 N+ x9 {
8 z5 `% A7 i3 x: @3 G" }var copyspeed=marqueespeed# {0 z5 b _( f! z/ l
var pausespeed=(pauseit==0)? copyspeed: 0
$ K/ l6 P: x3 n3 Q1 @6 Y3 `* kvar iedom=document.all||document.getElementById
$ o4 }$ c5 r1 s8 | Fif (iedom): d: f* \; s3 ?2 C. w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& @! W. F% @7 Z2 Y0 o0 Qvar actualwidth=''
! m2 O$ A% N3 Z: _var cross_marquee, ns_marquee7 w7 \+ E4 a+ C* C# {8 l( w# @( f
0 M% Q# v9 F8 N/ x* M3 j
function populate(){! s7 X, l3 q/ I
if (iedom){+ w; u, ?# P# k* ~7 V9 f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' u- T" L; {' i% C& Dcross_marquee.style.left=marqueewidth+8" }/ m7 Y6 r1 W* |: c! L7 U
cross_marquee.innerHTML=marqueecontent
6 y5 K$ l* x0 M$ c) ?1 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 U5 J; ~& [/ d' g- o
}6 U. I" S1 o" M0 n4 W# x: @+ ?
else if (document.layers){2 U/ h& Z! m; j: g) n
ns_marquee=document.ns_marquee.document.ns_marquee2- S( ` {: w7 a' q
ns_marquee.left=marqueewidth+8$ `6 [8 h. D) p% A2 X* C+ h+ V
ns_marquee.document.write(marqueecontent)8 q3 e) g* ~ G% u
ns_marquee.document.close()
% L) }" K0 O0 J' p% x4 D4 Z2 {actualwidth=ns_marquee.document.width9 ~ E* z2 ?" Z. Y% [* M7 s+ ~8 D
}* n6 h4 _% J4 k7 \8 ~9 y3 W5 `
lefttime=setInterval("scrollmarquee()",20)
$ E0 v) p R; n( \) T}
* {: T" W% z# O( c5 ?4 jwindow.onload=populate
$ M5 f$ S# x4 \ g; b! S( g% Y
4 A {5 R7 P7 B. |9 \! u2 _( D) Ufunction scrollmarquee(){! [) C+ ~, [% B+ e
if (iedom){" t* h+ h: u; A. |1 M. m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( P8 v) _- p, {8 T7 u- i1 i7 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& a- [7 U& W' B6 a, ?; f, qelse: H' u; A; D O' ^
cross_marquee.style.left=marqueewidth+8
* A4 O. u5 E1 @. S0 [5 j) U$ {; J0 G. }4 _; ?7 l$ d
}
$ h8 h! u) O; g) n! nelse if (document.layers){
Y0 a' I- B2 I \( }6 J2 A6 c# oif (ns_marquee.left>(actualwidth*(-1)+8)) l) A, x/ Z* z% G* I# [( @" B
ns_marquee.left-=copyspeed
% x3 X0 N! H1 n1 Z5 e0 Relse
. |% {1 [: j; w# M3 R: P5 Sns_marquee.left=marqueewidth+8, X" U+ k0 N7 n' @8 ^7 I, Z+ b( c; N
}
r' J4 d/ u; t9 U% g% a}
! w8 `! \* I/ S, s' k, V: L( e: R) e: k, n# m/ t# \
if (iedom||document.layers){
# X# D# p5 `( Ywith (document){
|( E9 l; ]. Z( q/ Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( ~; I- x7 z4 ~3 _$ B' @
if (iedom){4 U& y5 n8 Y! e8 N4 j( o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ J. C) D# R! f1 z- v. C, Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' o) z& n4 P! d, ^$ u" f* X2 s8 H) ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ i( F; q" H. l
write('</div>'). g& z" G- T" \% @" A+ G$ S
}
2 f* V$ c0 q6 gelse if (document.layers){
; J \" G7 n* W" Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, V8 X* n9 k6 P% o9 A6 E+ A$ C- owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
W- L, `/ r1 `) w2 V/ E9 N! \write('</ilayer>')8 c9 Q' Z" `: c3 L
}% |5 ~- O' d! B0 {* P
document.write('</td></table>')
' L" m! I# [" s7 [ W}/ P" v. E' X( K
}8 m. k& a: N4 J2 d) Z* f
</script> |
|