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

|
网页之跑马灯文字特效
//修改宽度
( Z9 Z/ i3 c+ G- ~var marqueewidth=300$ P2 j) C8 p! v- k6 {: T$ P( w8 [4 s
//高度# S& p# w7 N( E8 `& W& `8 N
var marqueeheight=250 I- P9 G. N1 f2 I% n/ v% n
//速度(1-10)
; ?3 F1 r, r' K" X$ pvar marqueespeed=3
! r9 s5 p8 p+ l7 t# c//背景颜色
% E# f9 A+ ^7 ~) N' O& d$ ivar marqueebgcolor="#FFFFFF"
; Q/ T+ Q3 u7 T0 B% \! \- f! t) r3 k& k//是否能暂停 (0=no. 1=yes)?
2 `! W* i7 a# a6 M1 ^! {) E7 z- bvar pauseit=11 v' B4 D6 z& R, ~
5 J! M9 |6 M- j' \! A5 C9 C4 t; o1 B
//修改显示内容
) q* m+ a+ e# v8 ~* P: a& N- ~* \7 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; ~0 n4 z3 d& g8 U, x0 t: K( j2 R/ J6 t2 m, ]4 a* g+ s
7 t* @% l5 Y4 B% ~+ c! D- j: L
////下面不需改变////////////# k7 n3 x) V& `: l; Q6 E
/ _5 X t- w, Z) D' a W [% v
var copyspeed=marqueespeed
+ W8 Y8 f# _4 N! D3 Mvar pausespeed=(pauseit==0)? copyspeed: 0" @- w; ^ p5 M+ K9 R7 f) Z0 b
var iedom=document.all||document.getElementById
9 m0 k8 b9 o2 eif (iedom)
2 ~2 C# S6 d+ U* b! ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 ?; b- ?% Z/ c4 f2 H+ T
var actualwidth=''
# H: I( X4 L4 v+ ~var cross_marquee, ns_marquee& \" ~8 p9 V2 u u; [! F' I# ]
' }& S9 |, v5 i3 ]/ Z: D% P# r! Dfunction populate(){. M. [3 q5 r# @
if (iedom){
0 I. c U6 d/ J5 g/ P# F% Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 @9 O/ I* h/ Ncross_marquee.style.left=marqueewidth+87 I' U0 i/ n3 A. |# F! q( R
cross_marquee.innerHTML=marqueecontent
! U) B, a% p* |$ U3 a- y iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; q+ W0 h# z4 Y' S+ w3 E}6 d1 q$ `% U' v6 o
else if (document.layers){
0 z. K1 r9 A. e: {! E/ _8 yns_marquee=document.ns_marquee.document.ns_marquee2
% p6 i* ~( Q' C3 E% ]ns_marquee.left=marqueewidth+8; p+ b q S$ v3 [# N
ns_marquee.document.write(marqueecontent)
- y% G4 K9 P$ A; f" Bns_marquee.document.close()' Q& Y- L' I; j! W$ B! n
actualwidth=ns_marquee.document.width
9 k: p& T1 K# P/ n1 `}2 k4 b5 j4 R) a a* a
lefttime=setInterval("scrollmarquee()",20); g* Z; h3 ?. X$ K
}
3 E/ r, j9 y6 v& B% Lwindow.onload=populate: H, `, o3 d9 u0 u" u
; g/ S2 n3 \3 @3 @, I5 b bfunction scrollmarquee(){6 S$ v4 i' j% b1 Y
if (iedom){
6 q* r- G+ G$ ], O: A. I x% C2 V, Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 [* o1 N1 \3 W* K1 M6 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 @& x: V8 }) a. t* \3 l2 c
else
) h+ W; c8 v3 f) Icross_marquee.style.left=marqueewidth+8
1 o# |- _6 y8 }
; O3 y# D: I. h}7 J9 b: L9 I, M- F
else if (document.layers){9 X# d) \5 _5 A9 I8 t
if (ns_marquee.left>(actualwidth*(-1)+8))1 j9 V# u$ s* {% |9 F
ns_marquee.left-=copyspeed1 g% m: G, ?) W9 \6 [7 ?
else
' z1 @! Q, Y2 ~6 q% q% bns_marquee.left=marqueewidth+8
4 x7 M$ K6 D6 S2 O4 d7 J3 c}
# D* V! |1 o% }}( f; H) [( j4 d! ]
+ ~) _+ \7 ~8 a
if (iedom||document.layers){
3 n% R y8 K- c8 W) i0 ~- Mwith (document){
; W3 w! u4 h) f+ N/ z/ H7 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ^ p4 x/ \* m- y: S- \if (iedom){" L M( O+ t5 @0 E/ K3 x7 F- m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). \# n* }$ X6 `* l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- v' h( c, L' T" ^- Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 H" ~. f+ r5 v* r) iwrite('</div>')
( \ T4 m3 u( c}
! {5 y) p* i3 M5 |1 g: {else if (document.layers){1 R& B7 P' j1 R- i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- g0 s6 H/ e6 C' Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 f; I# x, l5 M% }
write('</ilayer>')
7 O8 i1 _+ i% |' P, O}% a7 W4 c+ S p- E9 x0 C* T
document.write('</td></table>'); J' j/ ~2 \. U2 P- n4 O# a
}2 Y M& K& d7 Y4 G
}
6 |; S& s" l- ^</script> |
|