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

|
网页之跑马灯文字特效
//修改宽度
. |8 @3 Q) \5 e4 x# [! I9 Bvar marqueewidth=300+ T8 I$ _2 X; H _6 c5 Y
//高度4 }+ f& G( T2 W7 m3 x/ E1 K
var marqueeheight=25( s+ k! q7 s8 p
//速度(1-10). V" B, a& U% g J( {9 p6 z$ _
var marqueespeed=3' }! L2 \* b+ T$ O4 e% S
//背景颜色
- N4 r- |3 a4 c9 d& |" j. Rvar marqueebgcolor="#FFFFFF"
. r8 _3 V: q/ J e+ Y x1 h# }% D//是否能暂停 (0=no. 1=yes)?
0 |* ~, \8 |3 v6 G0 _# Bvar pauseit=1
3 }5 R! s8 Q) y5 ]( a8 _ I: x- z3 ^2 a+ w5 c1 ~. D- G
//修改显示内容* E o; G8 b3 ]4 e0 Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& I8 c1 y1 R2 ` y" b5 W) r" G7 |4 r
9 G" z0 ?* C' G6 g: [. K( [
////下面不需改变////////////
o9 w5 x" z, n; U9 O- U8 h/ {% F" s+ s4 C
var copyspeed=marqueespeed
/ X/ x8 R/ T" c5 Rvar pausespeed=(pauseit==0)? copyspeed: 0' H0 N" a# k$ @; Z! Y. a, A
var iedom=document.all||document.getElementById
$ ^4 ]+ ?# G! I% n* oif (iedom)
9 j3 Y7 y% G Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 Y' D9 W6 i0 V2 b0 `: u- hvar actualwidth='' Z2 n- K7 o3 D( O. Z
var cross_marquee, ns_marquee
) A9 }: J' m4 p: f1 t7 g
' Q+ ^+ @8 I5 jfunction populate(){. D5 N5 k& S. C2 F
if (iedom){. P' T- f* `/ ], K7 V$ C" U+ \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% g3 v; l! H2 J2 x+ t/ z
cross_marquee.style.left=marqueewidth+8
" D& q3 o- g2 l2 Hcross_marquee.innerHTML=marqueecontent% n" T" @& I4 W {; q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 _" v ]6 u7 q; z9 |
}
5 O6 J/ }" l$ @& o1 N, oelse if (document.layers){
5 `4 y3 |8 Z/ u$ V) k, Yns_marquee=document.ns_marquee.document.ns_marquee2
* S; R+ g. b! K2 l; u6 w) Sns_marquee.left=marqueewidth+8 o" h) P0 m- X3 Z0 Q# |
ns_marquee.document.write(marqueecontent)
$ c6 |5 U" p \ns_marquee.document.close()1 D5 {2 I m( V! z9 {
actualwidth=ns_marquee.document.width1 `% l' N+ r0 X* h
}0 n7 N$ @' ~9 _+ N( g: \
lefttime=setInterval("scrollmarquee()",20)7 O; | X" ?6 R7 f! [
}
8 r) ?# B+ S( z* n3 F' r+ j4 i3 H% s. fwindow.onload=populate9 L4 T2 v' Z- ~2 }
, x ?$ Z. @5 T) i5 B
function scrollmarquee(){' D4 ?' r2 O9 y) m
if (iedom){; A8 |6 _( d9 W& ^9 h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' h h# Z# W( d+ Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 S# V) v/ c% w! uelse
/ @! B5 u: Q- u# F8 l! tcross_marquee.style.left=marqueewidth+8
% b. b6 H1 h6 ?( C
( |3 K9 b' E( Z. C; K% w! A}
z4 E- c/ b" F) w+ {( ?0 q9 delse if (document.layers){
; g9 s+ y1 Y, U8 Q' [5 @if (ns_marquee.left>(actualwidth*(-1)+8)), O6 W' [: u# J) p; g4 {; {
ns_marquee.left-=copyspeed
" I7 S. i: t& j0 gelse" r2 _* |7 r1 Z* B( |1 z/ d
ns_marquee.left=marqueewidth+8( V* X/ d, V8 E2 P
}
+ j6 c( U H. o6 C* F}
, W) D# R; C: g5 o v% a- K
2 K+ {" X0 S. Dif (iedom||document.layers){
1 o0 H v, z* t+ E9 f7 O/ Awith (document){1 E3 {' x% u2 K% }" |/ y1 y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
^9 K" t* h/ r2 M Wif (iedom){
2 Q/ `+ @( j% pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 c; s& S6 } j( k7 W; u: b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 _9 j5 M% R0 l" v7 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 @, r$ F7 S6 r/ Q" \6 V
write('</div>')
4 b" y+ T% v% g}
1 h& H0 w& ~( X! [+ Oelse if (document.layers){
0 z4 L. u; @" u) n- ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); R) y# L6 _, X1 P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& f) V& {! v; f
write('</ilayer>')
% P& A: @, d/ p}
- T3 e- z' ^3 qdocument.write('</td></table>')
5 A+ _5 ]6 |8 x- j}
- w B5 _4 |) b2 S}
0 P: ^. {8 i3 L) M7 T</script> |
|