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

|
网页之跑马灯文字特效
//修改宽度
0 c& l. g, o. O, c' t8 _var marqueewidth=3003 e- G3 r- T( l, j- V3 C5 D
//高度
3 V; a+ Y$ b. C+ m7 p0 yvar marqueeheight=25
5 _8 g# R7 C( X: F6 n6 D( e9 c% u//速度(1-10)
! l8 m2 L; i3 {: \3 fvar marqueespeed=3
7 L1 Q# ?) B$ P, i d7 {5 P8 V3 _: i//背景颜色0 k' D) o) d4 `+ b7 P- p/ x6 Q* l
var marqueebgcolor="#FFFFFF"2 a" q8 j5 g$ v3 f# i, q
//是否能暂停 (0=no. 1=yes)?& w3 [: Q' O! `$ H1 s
var pauseit=1
, C$ ]! X0 d1 y
' F$ M( L4 G" H//修改显示内容0 e% n( D! w' d) Y& E6 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; p- S6 {: Q& Z6 z% Q
; k6 `9 z% S' p! M. U
4 s$ J) b/ ^/ c$ s) i% x; ^////下面不需改变////////////3 K6 W5 t5 T! A$ m) J$ x" d/ S1 Y
/ Z" `4 w% }7 t+ U( y* ]var copyspeed=marqueespeed. T3 ]/ d4 X- n$ g" z* ~
var pausespeed=(pauseit==0)? copyspeed: 0
! j+ w( M- ~+ R# s/ P- Evar iedom=document.all||document.getElementById. R+ `# q) L8 C2 W& F
if (iedom)
7 _5 t# C; r: R$ ?0 edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 j& ?6 W& R0 S; F2 r" F9 F
var actualwidth=''
; A9 _" U/ \( [% x: G' Ivar cross_marquee, ns_marquee, X5 P" a9 |/ A- b9 O, R3 _2 \" w
0 B5 U' d6 ?4 H/ z% C4 Z% }* ]function populate(){ Q+ v; B0 m$ [' ~2 m. a5 K
if (iedom){7 q0 @4 \$ V8 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% u8 j! ^" O, h7 D }cross_marquee.style.left=marqueewidth+8, Q. T* ~% r, }; @- G* E
cross_marquee.innerHTML=marqueecontent
4 x! a! b d- R# Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
l3 G( b! Y1 W7 M* |! L}
Z" y3 S6 i N1 |else if (document.layers){3 w; A9 E5 t4 H6 q
ns_marquee=document.ns_marquee.document.ns_marquee27 e6 |$ @9 K: ^( ^ c9 ~6 W# h6 t
ns_marquee.left=marqueewidth+8
9 o; C# k8 U z1 V1 cns_marquee.document.write(marqueecontent): {6 w4 E" \: H+ }' _0 ]
ns_marquee.document.close()& X( Z4 P" ~. ]7 k" G
actualwidth=ns_marquee.document.width* s. L" P0 y9 f0 B, N- L4 G
}( B* m1 S) [3 ~2 Q8 |" s1 X
lefttime=setInterval("scrollmarquee()",20)$ ?$ q; \7 E1 q' U0 N9 F
}) }. s( _5 v1 P/ n% g" Q. A3 \5 l( Y8 q* _
window.onload=populate
" G. o4 U8 }4 {+ j' c* n7 x- L& E/ h8 |. J l+ r+ r( |
function scrollmarquee(){
7 P& |, j( Y, oif (iedom){
# y, }+ G6 I& q) h& { bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& k/ e/ C0 i* S8 K9 Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 ]; E" J& \: d: R7 [ Ielse
, t1 i' ]# |6 x" Bcross_marquee.style.left=marqueewidth+8
% V5 ]7 ^% w7 Y0 ?( V/ C
# C) H2 t) s. j6 o: ?2 j' `+ j}7 D8 w' {; u, A" }1 L9 m0 m
else if (document.layers){. K" S( y. {( r1 c4 ^4 v- H
if (ns_marquee.left>(actualwidth*(-1)+8)), d+ M0 z% [) k1 K8 ~ f
ns_marquee.left-=copyspeed
$ X4 S |+ T, F$ y! \+ ]else. b0 [% W7 N5 y! z& l
ns_marquee.left=marqueewidth+89 y9 Z$ [7 ^, w
}
9 ^1 R" M% p( ]% e$ u+ [& B}, c2 x' k$ r7 a' p8 X- Q
; x0 b5 Z9 l: a( P6 J- ]7 Z6 tif (iedom||document.layers){
/ i4 w8 ~9 {2 D7 a2 ~( g: cwith (document){
. B, [+ }! Q% Z/ \. s8 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& G( ]; {1 O2 O3 B1 Fif (iedom){
% m: f1 h' D. ^! J4 n8 H0 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ b/ f0 l3 ]2 s) X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 \5 c; H2 |8 |( O1 L, r( H7 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 P/ B& Q5 e) ]+ G& ^; ywrite('</div>')
* d1 r, ?# l2 \4 D8 Y2 m1 ?}
% Q6 r; D2 }: |2 I/ P# Oelse if (document.layers){, l$ K; I/ S' [! Q8 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ E# p$ d7 E9 d& p3 p$ z; w& ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 u. [# J" R/ u3 z1 \; X3 C- ?write('</ilayer>')+ s" g8 b2 k3 n" K$ e: F
}+ L7 }* m/ U7 R% p
document.write('</td></table>')( s# `7 h0 r- m2 f$ Z& e
}+ W$ o8 v* X3 v( T1 u" w
}
1 Z+ N* Y& J4 P* m3 [: j% _: m</script> |
|