返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! T- L& d7 t; y' G  ~& U: Avar marqueewidth=300% C8 q6 y. w  D' C; r- E  t
//高度
- ^! o8 B& z5 O* S9 Fvar marqueeheight=255 H3 S6 G' a" R, Q
//速度(1-10)
3 ]' |% e# I& S3 R: Z" H/ vvar marqueespeed=3
# T7 i* x8 D$ V5 ?2 y- K1 ], V& B//背景颜色" X  d2 z+ Q7 Q  ]" X
var marqueebgcolor="#FFFFFF"
6 T6 R5 m, |. r! g: o/ `; W; l/ Q//是否能暂停 (0=no. 1=yes)?6 g7 o, J. u% Y' @1 ]  f: l9 _* X
var pauseit=1
. ^9 L* U% |! B7 J+ D
2 M- a0 V) q# t- P9 }4 X//修改显示内容
1 F5 _1 G0 U5 J( _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: S. k' Q0 q5 U6 f5 t/ n8 l. _* l/ K0 j

9 ~" o% `* S; t$ |, Y1 X4 z2 f////下面不需改变////////////: w: }4 s/ v, R; \8 D! B
' v. b7 R2 d, r" F
var copyspeed=marqueespeed: I) X( B/ e) |+ a8 T( w2 ^+ n
var pausespeed=(pauseit==0)? copyspeed: 0
+ W7 F3 [; b/ ^5 N6 avar iedom=document.all||document.getElementById3 Q7 ?; x; v3 V+ L) t. d* }) h
if (iedom)1 I4 j! n) \: B7 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; a4 Y3 i$ Z3 J. r) I: R$ F+ O8 vvar actualwidth=''8 i8 R) r8 m. p8 m% V
var cross_marquee, ns_marquee+ ?" E1 |: z& t# I' c, p; k
: W4 X2 r; I5 p+ K8 T! j5 {, b, P1 s# v
function populate(){
) t8 ^: G1 G3 E: ?# [% P4 d. ]if (iedom){
& ]; x3 ?" W5 f# o2 `5 l, Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 ~8 S) D! w. i1 h+ _( X: w( [
cross_marquee.style.left=marqueewidth+8
( {. |# A- o3 n- U' Hcross_marquee.innerHTML=marqueecontent4 e$ c6 l( E! }7 m* w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  o* Y# E" f8 W( x. J# G/ l: u
}
! m8 V) L- N( c# q: Qelse if (document.layers){
6 q7 I+ W" n6 x, pns_marquee=document.ns_marquee.document.ns_marquee2$ u: D. Q# d4 B. n. o+ s+ B3 a
ns_marquee.left=marqueewidth+8: Z, L/ @) \+ z8 @; g
ns_marquee.document.write(marqueecontent): I& @. R6 \0 Z+ ]  A( ?$ r
ns_marquee.document.close()
3 R) l7 r4 H( u8 Mactualwidth=ns_marquee.document.width9 S) C0 |/ y. t0 @+ a
}
+ q' ^* }4 _+ A% O+ slefttime=setInterval("scrollmarquee()",20). V& \; ?$ x  L# d) @( Z
}4 _6 v9 @' c5 B/ z6 J
window.onload=populate
+ f+ [+ A  N; ~0 X
+ J- [9 T4 H4 U& d1 Sfunction scrollmarquee(){# B$ o: ~) a  o9 e; Y3 c, }
if (iedom){# H' b4 x, v) P: L6 o. k; Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! Z5 V/ |8 i6 p$ b4 @+ b/ Y1 N7 i3 }/ M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, @! |7 u; W3 J1 h- lelse
7 V* N; p4 \: J( w: @& Y8 _cross_marquee.style.left=marqueewidth+89 F3 s  B: D' j7 F

7 I/ v% g& \  a* Y- |1 a}0 I; q7 n3 w: F; d9 [3 b' _
else if (document.layers){
, X( W: i% g$ g' g9 Uif (ns_marquee.left>(actualwidth*(-1)+8))
4 l/ D1 n6 Z( k; k* sns_marquee.left-=copyspeed
% s, J0 c: B9 \6 q7 Velse
9 c4 J3 _9 ^' |- Rns_marquee.left=marqueewidth+8
  G4 ^& ^, s0 K, A& r}
. [& E* ]. u6 @" o$ h}/ X" ]7 v& @5 ~

9 B* l& w1 [! S! Jif (iedom||document.layers){% h( d% M. c' H; Y: T
with (document){
1 q: t1 }4 j& o" l3 ?: Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 _5 d+ D9 R1 I0 V/ U5 I, X" Mif (iedom){
% \, b# Z# G! Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( ?" }- I8 A5 _9 g; q4 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 K) q+ `$ P: X. |( V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ M0 V" I( d* z. awrite('</div>')
( k& i/ f# M5 j1 q( r5 ?}% R& v: X' P2 B& `
else if (document.layers){% _7 O+ Q/ j7 Q7 ^# q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- C- d7 ~, C5 T3 N5 W* ?2 r* @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), G; |/ A% y" s- v" b1 P7 ]: M3 B8 F
write('</ilayer>')
: W  s3 _7 n- E& s8 t}
; e$ z- K. K  `) tdocument.write('</td></table>')
. J! E" F5 @8 M5 D% X}% K9 Y) Y# G0 l7 |1 Q
}
$ d2 l( |8 n' z1 g</script>

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