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

|
网页之跑马灯文字特效
//修改宽度
' o4 ?6 L! S2 K) A( S3 T& Bvar marqueewidth=300( A" F8 ^+ w1 U( l3 E
//高度
9 ]7 q6 r- k1 q6 E0 n; ]5 D$ Zvar marqueeheight=25! M) z3 B7 r3 v: d+ N: E, l9 }
//速度(1-10)8 X! Z, F. R9 r# ` |: h
var marqueespeed=3
K% \8 S/ m8 T' ^8 ?9 j//背景颜色
( K( I8 P8 u- w& `" \& fvar marqueebgcolor="#FFFFFF"
! b1 Q5 C' U: T7 y8 M8 R/ Y//是否能暂停 (0=no. 1=yes)?6 s6 M# d ^# `$ O! `
var pauseit=1* `+ p6 k6 l0 V* K' Q
2 D: H7 _) q- A0 i9 f H6 L
//修改显示内容
; I: B; Z2 o. [6 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! }+ I% ^4 |) ^
4 K4 r1 i) n G% E4 h$ d9 [* e
7 a7 |. a8 f% O7 g) S% C6 P////下面不需改变////////////+ ~# }) A' t" [ I& ^6 W8 Y! _
. W" q* j" N0 j! k9 o. K
var copyspeed=marqueespeed
9 @4 a0 `& i/ o8 [var pausespeed=(pauseit==0)? copyspeed: 0- S" `% ~ U5 f; e& B$ k6 W
var iedom=document.all||document.getElementById5 Y& O" S1 E& Q! |5 z& N C# [
if (iedom)# N) E# T- I6 A% s/ ]( t/ v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 ^2 }0 Q, C% L% M Ivar actualwidth=''
- _* ^7 Y e3 n% y' @: @; cvar cross_marquee, ns_marquee2 f( n0 v. o' u) H! y2 p/ E6 C: H
) ^% ]3 p+ H* O0 K3 Qfunction populate(){
5 R: n- G5 C: g: y. v! Z5 i: R8 ]if (iedom){
0 x9 \- Z3 ~% l+ D" O1 `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 t$ H2 u4 A. u1 x1 Q6 }
cross_marquee.style.left=marqueewidth+8* I% G6 W- ^& v, _) W5 S, g4 P2 Z- p
cross_marquee.innerHTML=marqueecontent p, v3 T+ Z( q& z, w2 _; H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 v x+ m% x2 ?) ^& n}
, m) o1 h2 @% s) }9 @4 U e+ h, Jelse if (document.layers){
: Y- i, R0 n8 D# ~; \5 y1 O7 Ins_marquee=document.ns_marquee.document.ns_marquee2
4 F( M4 X# m0 Lns_marquee.left=marqueewidth+8
8 P4 d) ^4 }9 Z8 r3 x( gns_marquee.document.write(marqueecontent)3 L$ U) R8 P. Q Q# y+ M
ns_marquee.document.close()# } s$ x; I7 l: O% l
actualwidth=ns_marquee.document.width
) z; j& s+ j( t9 c}/ W) [$ m1 }' j7 V1 T" n
lefttime=setInterval("scrollmarquee()",20)
5 l0 r6 E% D, i4 z( P8 A3 O+ m) _}
" \( q, V1 n* U: N( n, ?# j" Awindow.onload=populate: X% k( f ^+ f2 d
; L! S0 q/ N# Yfunction scrollmarquee(){7 i/ d) s( w' z3 b9 Q
if (iedom){0 ]% W9 q. O) h9 a+ q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
[5 q# k9 B/ `6 U: M$ u) R- ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& p) X5 B5 b- h" D1 Gelse* e4 A) _- r, `$ t0 k# l/ d0 s
cross_marquee.style.left=marqueewidth+8
4 ?3 l$ \3 r- |0 d6 J1 M/ A0 ? i; u2 V- h/ S, a: D
}
( `) b4 o8 j9 C% E% [# Oelse if (document.layers){ I+ j7 P: v( l% G: {2 A9 [
if (ns_marquee.left>(actualwidth*(-1)+8))
( `% G Z5 g: C0 Y" lns_marquee.left-=copyspeed7 `9 g3 X( F% j# k* |. n
else
5 D$ e/ o: B( f; \% y0 [2 `, pns_marquee.left=marqueewidth+8
; @* ]( i! v/ S5 k, f}" @, L+ ?5 d t) x* T! P8 q
}
- K# i9 n3 j9 [& n4 h$ c' L S m$ T. ~) ?8 E
if (iedom||document.layers){% Y. A, |# [0 g) a# v; l/ U% V
with (document){
) x5 Y7 Q; @. @2 L/ e+ Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ ~8 O7 t3 n$ N+ n2 K2 O- v7 k
if (iedom){+ n( F; p% Y2 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 o; Q8 q' l3 h9 pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' E$ B% w" B1 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& H7 G+ s6 v4 q- f" L
write('</div>'), q5 c( ]4 D1 r' l7 j6 | [" n+ d
}3 O k; _. W1 [6 [6 t s
else if (document.layers){
- C/ m& y$ M4 V% {2 v3 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). g1 P G" N" e' o( C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 o% y* s9 F6 @: Z% L
write('</ilayer>')- Q# e U4 y( V
}; Q9 e; v9 H# v# g7 p
document.write('</td></table>')0 g4 x, Q t% S
}
+ l/ n0 x' ?) c/ u}; d1 G# ~; \- q* h3 j
</script> |
|