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

|
网页之跑马灯文字特效
//修改宽度! q' r3 _% v2 K% O- O. u
var marqueewidth=300' ?# ~2 U- e" x4 n7 p* h
//高度$ Q4 C" [: x9 y5 |3 G
var marqueeheight=25
2 d/ ]% F0 K1 r, w" D0 s8 f0 G8 t9 e6 B//速度(1-10)
\+ B5 R/ \% y) J1 b% zvar marqueespeed=3
, b, J3 ~3 ]: K& D5 a. F7 w//背景颜色
" W1 c3 b! o4 A8 Lvar marqueebgcolor="#FFFFFF"* h& b! ?/ m% n9 [0 w
//是否能暂停 (0=no. 1=yes)?
- ~. o4 I2 j, |7 n: Avar pauseit=1- k8 Z2 M' O4 B% g8 ?4 [1 _
) ^ H& ^+ S6 i! U' Z//修改显示内容
% _+ |6 T& _4 E9 | [& Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* S. S# C F m& C0 L/ r
% ^: ~" C+ y4 b1 n O7 s' p
9 u* u) u6 _' \$ G0 `9 l- |3 W0 q////下面不需改变////////////
, J2 {/ l# B: ?9 x! Z/ v/ C) d6 J# z) M5 ~8 G" N. ]
var copyspeed=marqueespeed
$ n( ^* \4 w4 K) I+ R1 z- uvar pausespeed=(pauseit==0)? copyspeed: 03 b' j; a/ L9 |, X( C% S. A$ c
var iedom=document.all||document.getElementById- F! R/ L O Y4 p- a9 q9 R
if (iedom)
9 s- e$ z1 y/ o+ ]5 g9 z% R, ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; j n7 e' u6 m8 @. a1 yvar actualwidth=''1 v: K' L. T' |3 ^( d) g
var cross_marquee, ns_marquee8 s; \: C/ Z$ s
) z/ W# o* K' T7 b2 I$ j' `" e4 ~6 Ifunction populate(){6 V+ e% H6 J7 j0 \ s- f5 o$ a
if (iedom){7 @: W" A4 @# m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 k, q3 J6 @4 V# i+ ?cross_marquee.style.left=marqueewidth+8
0 T% P. C% s& C7 ocross_marquee.innerHTML=marqueecontent# O T5 v* c- B k U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, G0 J2 v# B+ R4 S}" ]# c) l& G8 t: K+ c
else if (document.layers){
5 C& f" ~ L3 E; `) \; g8 Jns_marquee=document.ns_marquee.document.ns_marquee2
9 R. N | [, h$ v6 @/ dns_marquee.left=marqueewidth+85 v$ O; c" b; ]* h' E' X" _( ^1 Y
ns_marquee.document.write(marqueecontent)
: _* G; E! L+ @$ t/ pns_marquee.document.close()
2 ]4 e {- M* M; M; Z8 pactualwidth=ns_marquee.document.width& ?* G. B& _7 E3 G* Q
} F( }* f1 v; H( Z
lefttime=setInterval("scrollmarquee()",20)
9 _# r# i4 ]! @. i}2 U I* X" t% U/ G) u
window.onload=populate- m; I" a& M# T M5 N! J: X
# i8 {9 ^% Z: t5 u! ]- {) f
function scrollmarquee(){2 t6 U Z# q& P) l' s* x }5 s
if (iedom){
) z, w h, A0 ]+ Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 e+ A4 |0 | \8 Z# Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% Y; F* A% q8 Y- N6 e, Y( Zelse; I/ I8 T4 m2 S, \
cross_marquee.style.left=marqueewidth+8
* S1 P& F4 M# b+ S" ~2 h2 V2 z$ |' \6 d9 ]; B
}( L, q2 @3 O: \8 |$ ^
else if (document.layers){& ]3 e. m8 n5 k
if (ns_marquee.left>(actualwidth*(-1)+8))
+ T1 I4 j1 r( Z5 l; H x' Vns_marquee.left-=copyspeed
( o. t3 _' }! E {) Oelse2 _% \: T5 p( R# d- g& p
ns_marquee.left=marqueewidth+8( l! { w% M7 }/ Q) \' A/ h
}
* U' }, J: G' I8 l& ?}. Q* e' S" [" s% h- h$ j
, m$ N; O! U- b5 ?* h
if (iedom||document.layers){5 c/ x7 c' n# |( D* {3 y! i
with (document){
$ s, j7 O8 q2 Z6 C( Z4 s$ p6 A- odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). J; _8 ~! \6 A
if (iedom){
6 T4 V4 C) \7 |9 L rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- H/ e% a, ?+ c! V. K2 z: @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ o8 X a1 u+ H7 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 l/ t! l3 ?7 h0 O8 H# Owrite('</div>')6 v- z) X5 D& A" x$ w/ P
}
$ F7 j6 }+ g( gelse if (document.layers){8 e+ y, C4 U/ A$ f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& k, @! \- w4 [6 J$ ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 l m1 m1 Z4 T8 g7 s4 J Mwrite('</ilayer>')
8 F/ t' Y; j% D4 V5 u2 G' \/ x}
: x' `+ t* |$ K3 i/ M( T( xdocument.write('</td></table>')
, a2 z( y8 b( S1 S}8 O% T. U& {& A- `
}
- |& x/ M1 Q; ~, ]$ y* n9 _) j4 W</script> |
|