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

|
网页之跑马灯文字特效
//修改宽度
; K& h; ?3 U& Lvar marqueewidth=300
/ X" a( J/ Y3 \( S- k9 Q2 E8 B//高度
, @! b$ {( G) d% L2 l# n4 E, F" bvar marqueeheight=25, x6 J- O# v, |& ~
//速度(1-10)
4 {* n& C! F+ c! C$ @var marqueespeed=3
- w4 {5 V" o0 ^: ^- k% c' o8 I4 w//背景颜色
( D# W! L, X" q& W4 d" a. V$ w4 Cvar marqueebgcolor="#FFFFFF": |0 C4 ^1 M4 j1 w! r) f% k
//是否能暂停 (0=no. 1=yes)?
( s8 G9 a% [( z" n& [var pauseit=1
+ y+ R! n/ ]( {1 ^( H9 z6 u. p% ~# V! X7 z+ ?
//修改显示内容# J) ^7 G3 E$ b9 g6 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; {% |7 K: b, E! L0 m% W1 q- B B( a4 H1 |/ e
; q5 A3 x" l: a5 K2 \3 C////下面不需改变////////////* t) N; H6 T/ N& L
2 B% E( q5 z% u" d9 O7 ^
var copyspeed=marqueespeed
# h1 ?( ^' P7 W- g3 d- G# bvar pausespeed=(pauseit==0)? copyspeed: 0
# f9 y3 y$ p, ]: Z. o! w% Mvar iedom=document.all||document.getElementById
0 N) N% R) m: U6 ^& @if (iedom)
' | B3 p4 P7 ^ u$ O% ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% {6 C% ~& \% avar actualwidth=''
2 \4 } x ? t2 N( r7 @* ]9 H8 E; \var cross_marquee, ns_marquee
% W7 w: F6 m# p% e$ V( l" v# v3 S
function populate(){
/ d+ H5 v. K( b2 h+ Y3 R& |if (iedom){
: p' X# w4 q l- bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' ^: w* z6 M! n; l+ q% Ucross_marquee.style.left=marqueewidth+8 S- L. Q; H0 H+ F' k$ C, U1 a
cross_marquee.innerHTML=marqueecontent
0 e2 l/ k% O& factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& o9 s( ^+ l0 j7 k' G; l}
; B5 O9 x- [3 F. G4 ]& felse if (document.layers){" Y+ z/ e2 b, H! e
ns_marquee=document.ns_marquee.document.ns_marquee2* g1 S# R& R$ @" o+ a
ns_marquee.left=marqueewidth+8" P% w( W: U& o2 p) f! _
ns_marquee.document.write(marqueecontent), G/ C, w9 G/ }. p2 s9 x, D* `+ Z
ns_marquee.document.close()
0 _& t. X7 b1 L+ F: P3 Z6 C' O. [6 Factualwidth=ns_marquee.document.width0 u" c- Q. E* N% q
}
$ F5 }1 }" f1 clefttime=setInterval("scrollmarquee()",20); Q- O2 v$ w% F% f
}
/ `% z: r: {1 A2 y& ^1 i- }window.onload=populate
- a8 A1 p+ p: |+ i
1 x2 A1 c* A4 G7 W2 ~5 Hfunction scrollmarquee(){
$ l. X- `, ?2 P$ d# T& U! ^if (iedom){
, G5 m( u! g. qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 C l, e& U, V1 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ q, G/ `- [% W! |" u$ F1 v
else
1 `3 K# l2 G& D8 \/ m4 u( K1 b/ Qcross_marquee.style.left=marqueewidth+8* X5 N& Q+ y. J
! R8 n& t4 ?) p9 r}
( P$ L+ a9 u+ Z( C7 Z/ Nelse if (document.layers){
8 X5 G; _8 R3 h3 ^. ~6 Fif (ns_marquee.left>(actualwidth*(-1)+8))
3 k0 O' h/ G$ wns_marquee.left-=copyspeed
9 H) R0 k8 \% Q- a, Xelse7 x8 t2 X3 b! { {$ E0 v0 [
ns_marquee.left=marqueewidth+8" C+ _9 o u8 U" t+ U
}+ \6 i7 s0 h7 w( H! r/ H
}
) m1 R- Q, g5 r7 y/ G1 W6 X: t C$ w3 O
if (iedom||document.layers){# r# H3 C( R( t7 a' l0 R- I
with (document){
! ?1 S4 i! H) B6 }0 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& W; @4 ]8 ~6 P2 M8 ]$ e
if (iedom){
: k" l/ i. b& ~4 y& ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# u, [# O( T5 D; r: W6 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. X! c7 A4 t' F! Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 S+ b/ h) v6 c' ]* i2 t1 X
write('</div>')
: ~7 T) o( e2 H) V}
& o% R3 g& Z. ~8 W' a' f' uelse if (document.layers){
; K. P. }/ m! a6 U: i1 V* twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 `! ~/ W6 Q$ e' x* \3 R* |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' K! T2 F; Q; @. l4 Y) z( X% x6 d
write('</ilayer>'), E, e/ Z2 {- P' {
}
! O( B% r: t, o2 Zdocument.write('</td></table>')
' Z. I, }+ J o- _8 q}
; ?# h# p0 \2 A9 q! E' i}) q1 d, `) u4 a' k) R" i& J7 ]" M( x
</script> |
|