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

|
网页之跑马灯文字特效
//修改宽度) j( f) T z0 s& s) w; z+ }& F
var marqueewidth=3001 {- ?. N2 D1 n" F9 v! ^
//高度 |5 N( q$ z. b+ M) a
var marqueeheight=25# H4 s& g. m! _' o1 {; z8 ?
//速度(1-10)
0 F8 f1 a- Z+ K9 hvar marqueespeed=3
5 Z; R2 K9 }2 ?- L' X; g: n//背景颜色; }) `" g B7 H R5 R
var marqueebgcolor="#FFFFFF"
5 x0 X8 N2 O/ `5 c! c9 P//是否能暂停 (0=no. 1=yes)?, f" A8 ~; i9 s$ h$ o
var pauseit=1( l! q8 I# K) u* H) }6 Z* g9 F1 w
6 ?' E+ b' T% E. ^8 z! ~//修改显示内容
* u* [9 m% J! ]" J# ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* z% T0 o2 G8 @
9 f* A# N- l8 _- c. b' D% T4 W$ ~. f
////下面不需改变////////////# A, X/ H2 R# d0 |4 g: j
) u6 l3 Q/ g( b8 V' s. @1 U9 b; Y7 Yvar copyspeed=marqueespeed
3 r) C+ s: B/ x, D9 Zvar pausespeed=(pauseit==0)? copyspeed: 0* d) C. a6 u* k$ n* q9 _
var iedom=document.all||document.getElementById
8 y3 X. ?+ S' S3 h* j, B: s9 {& c7 vif (iedom)
/ c1 |1 Q5 L/ A5 J$ P v1 d7 U( D% sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') m* O" t8 H% p0 p, b$ y/ G }
var actualwidth=''! S2 f3 e7 x9 C& b0 P
var cross_marquee, ns_marquee$ H- e: m8 z7 k% I) n Q& _
% c; e, p: ^4 C# X+ n% B! sfunction populate(){
: H' N8 `! r4 xif (iedom){
% B9 v c X5 h$ {: Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 q2 _* {1 F& b" Z+ \- w, Jcross_marquee.style.left=marqueewidth+8
! |; Q1 t- X" X6 Qcross_marquee.innerHTML=marqueecontent6 `8 t# z! [0 B1 z; h& {- {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( g* f$ ^, a3 ^+ I8 B+ I
}" I6 ]6 `; G$ e+ V0 w
else if (document.layers){
6 D0 D' s, p& V8 _ns_marquee=document.ns_marquee.document.ns_marquee2! C6 j4 F2 K. h+ c$ t
ns_marquee.left=marqueewidth+81 [0 k6 I+ ]$ J) _- f
ns_marquee.document.write(marqueecontent)
* ~* o6 o* P- g5 H3 E5 _& Bns_marquee.document.close()4 @! ]7 n, ^$ m( Q' y
actualwidth=ns_marquee.document.width3 f; l, i( f+ O
}
. \# f9 X6 [0 `( m" Plefttime=setInterval("scrollmarquee()",20). L% L+ k- k8 h$ _, H
}3 |: g# \' b& r; [2 Y! J, ^% v
window.onload=populate6 o3 i$ u3 g0 R$ g1 ~
6 R$ f. q1 d- R. p
function scrollmarquee(){, P. h& F8 u* w8 G% p" ~% v
if (iedom){
! t5 N) S& }' g$ e* _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 k6 `5 K( r5 \, qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, S; ~' Z: c# B9 t$ B! v) h
else
6 y" T+ H, O$ H+ E% ocross_marquee.style.left=marqueewidth+8, @- G6 s8 I1 G$ A+ J
/ D0 ?4 H) }2 }( G% y; F}' D& U( K" N2 Z/ s7 i, \
else if (document.layers){8 ]' Z+ g5 S: @5 G) W
if (ns_marquee.left>(actualwidth*(-1)+8))# T M, d1 [" K
ns_marquee.left-=copyspeed ~/ l7 w4 _4 O# g, S8 G
else6 t) o/ o8 N1 Z n. ^& ~
ns_marquee.left=marqueewidth+8
& a; `0 \& _' @) S( n% z}
6 F& X% ~- D& s}% d+ \9 B; r7 j
% ~3 v+ d, R+ f) C$ e/ B. oif (iedom||document.layers){9 E" ~. J8 @2 z3 x" ^
with (document){" n/ K& ?+ B8 B9 y) G* L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ D1 `. {& m7 N3 ~if (iedom){
. h+ G4 c5 ~" \0 S& O, vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* s# J( H2 d; i1 s# `% Z3 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* b" z1 e+ A0 l. N# m# e1 `; H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 a. _$ D& h, b, F; @
write('</div>')6 D/ h6 F! m. Z( K) O! W
}0 s" ]/ B, W% k( [
else if (document.layers){
, V% d! v) T& g( iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ s! \* g% ~% F' i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' J! Z3 Q# x Z5 t2 ywrite('</ilayer>')) j6 h' U/ U H# z# y
}! }3 k, X, z; {" p
document.write('</td></table>')
2 V: H" N2 P5 q2 s: v- K}
* Q" G1 e5 t% K2 u' Z, R- `}- |6 @ _: c& V% s( U
</script> |
|