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

|
网页之跑马灯文字特效
//修改宽度 K% l& ~# u3 b; j6 C* E' U3 v
var marqueewidth=300
- D9 j, ~7 H. ?4 V ]//高度
. ]5 n, W$ d V8 i1 B( O/ Dvar marqueeheight=25# y ?7 {* y: X. {& Z
//速度(1-10)
4 F6 M$ p+ Q# l" ^6 H2 o9 xvar marqueespeed=3
N, ^' y) H8 A3 B9 Y2 K//背景颜色
# }, S% q' w4 d* C$ @var marqueebgcolor="#FFFFFF"$ J) a! |# y- s! q+ s7 H; ?
//是否能暂停 (0=no. 1=yes)?2 k( f. v" Q) V# ]4 b0 C
var pauseit=1! G- B* G `3 X0 K, |
1 V5 U9 ~) o( {. Q3 b- p% ^
//修改显示内容+ z- |+ O" |! V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ p2 t4 F* L+ M2 g* |. ]9 p0 }3 X' ^: n$ d7 I: s9 _; I' I
$ I4 M. e* e4 F# H
////下面不需改变////////////
+ r, R. i% d* E4 y( P9 l6 b
8 `9 ]; o5 m# ]6 Qvar copyspeed=marqueespeed l4 M+ p: P' s4 r
var pausespeed=(pauseit==0)? copyspeed: 0* p* A( e( w: D4 k* z, _0 f) S$ Y4 [
var iedom=document.all||document.getElementById
( j% ~' ^# C( K) U, L7 cif (iedom)# |% b% u2 u3 l/ S2 O; d7 o& m6 G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). d' ^5 x! f* ^! j& r3 f, @; E
var actualwidth='', @4 o1 v6 T' j( C H
var cross_marquee, ns_marquee9 w* C- o9 ~3 ^! k# e
$ r. ?+ g+ [8 r7 ]. G7 c
function populate(){
2 q, n8 A$ _4 J4 J1 Y: N7 yif (iedom){! i- Y, P) w: {9 {6 p# T3 e$ b+ M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% ~( t6 M9 \8 l, v- f4 Q) @7 E' Qcross_marquee.style.left=marqueewidth+8
( K, v' `. I8 c2 a8 d7 rcross_marquee.innerHTML=marqueecontent6 v1 R1 `, V2 b5 Q' R4 U E1 G& R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 M3 {8 D( S) P: o: H* ]}
# V z' n) H& k5 nelse if (document.layers){
) d8 q, @$ S P9 O, J4 n- ]ns_marquee=document.ns_marquee.document.ns_marquee2 `& T* d- v) x
ns_marquee.left=marqueewidth+8
4 w1 t& q4 R. _ns_marquee.document.write(marqueecontent)4 w, J" b' C. u% x8 I2 C7 k
ns_marquee.document.close()1 i5 Z# ?" Z7 i
actualwidth=ns_marquee.document.width7 c, \/ D8 y3 C8 X! [5 J- L0 m
}
8 \2 R. Q1 @7 Q/ Plefttime=setInterval("scrollmarquee()",20)
/ T* g9 v3 D1 \: ^: s: j9 X}
7 T5 m6 s `& ?: [2 twindow.onload=populate
0 b2 Y3 T6 V `" h4 r3 F# r1 I4 e6 K% a7 L+ M p& O
function scrollmarquee(){' z4 [( x* a+ A4 p' r3 I$ E
if (iedom){
& m0 n( Q1 l7 N1 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' T" G& Y/ J* C- D* M6 s: Q4 K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! X9 ~3 x9 M: V. L4 C F
else0 f5 | m4 l7 E0 `. S% ^2 ]' g9 |
cross_marquee.style.left=marqueewidth+8
1 m% |+ n' {" Q% ]& u$ l
% W5 E' X4 Y: V1 l" z! J# I! x3 j}, C+ ]& w' L/ B$ V6 O/ a% \
else if (document.layers){( y- c* b$ W d+ l2 u, j
if (ns_marquee.left>(actualwidth*(-1)+8))
& o$ X5 l* K, _8 z5 f' y* Ins_marquee.left-=copyspeed
* K& v+ e {( a( M! o @else" A! U3 b% R, \. E2 c
ns_marquee.left=marqueewidth+87 ?* b! J' W) p; R
}0 ` A: L$ e0 f9 R3 D# N
}5 @9 i( p% _. h w) D0 }+ D
; _1 e# Q/ c: P
if (iedom||document.layers){: `% t6 v! W9 F' S+ i* {5 r& B8 ?
with (document){
! x! D+ W0 A" f2 @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( v. y$ n5 E: d/ C; x$ Zif (iedom){: R: A9 E" n0 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 F$ s+ y, }& @" R- {3 K( ?' q. ?& twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) i' g% N1 a2 o! S3 L, R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ ~5 N6 G9 f+ ]/ R) A0 [( D
write('</div>')- I) U8 T& o Q+ d7 M3 v7 A
}
& E4 H7 D8 P u- N i7 Celse if (document.layers){
/ G6 K% V, v# I$ \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 y. E. q4 \' U$ @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ Z" {( O1 I3 [' ewrite('</ilayer>') ~, V/ [) y! i( L' Z l
}* l2 B" p9 e7 F9 Q
document.write('</td></table>')' o( [" ]. _ n r8 [5 ?! t
}
6 S6 s, K$ Y' J2 c: b+ t' S}# o) Z* K7 w5 L! J6 t9 h; {/ T
</script> |
|