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

|
网页之跑马灯文字特效
//修改宽度7 M$ m1 d3 U( z! O5 N
var marqueewidth=300
5 t3 L& R7 |9 Q//高度/ D& f0 a5 q0 ~5 \" l b) N, @2 w
var marqueeheight=25, V. T- t, E6 }4 v: p8 T6 i
//速度(1-10)
( R- K9 L x- f8 Lvar marqueespeed=3
: { k( d# D3 E# p8 ` g//背景颜色/ r: M P* y) a- o
var marqueebgcolor="#FFFFFF"& H a$ a: c6 b" H% v+ c
//是否能暂停 (0=no. 1=yes)?: ?0 `; w% i* ~
var pauseit=18 M! y* ~* x: P7 N8 S) R7 |
8 p# t9 }. Q- [. ?( C9 c+ Q3 b//修改显示内容- M u4 u5 P6 @# x9 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; g/ M# i) s+ d) {- Q$ B! n
$ i, j& e! B. q7 ^
& J$ P9 t) c* F////下面不需改变////////////
6 W# [: w! y4 ~" O0 {' S. l( l9 k+ N) C
var copyspeed=marqueespeed+ Y$ j+ [% ]7 e( \
var pausespeed=(pauseit==0)? copyspeed: 0
/ X& \3 n% S7 B# Cvar iedom=document.all||document.getElementById
7 W2 u6 W3 E6 G3 V9 `( ^if (iedom)9 _" Q3 e# i1 u: E# h: W. W9 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( v) \% u$ y. l- f) {
var actualwidth=''; K" T# N; ^! n' W7 ?
var cross_marquee, ns_marquee0 {" M) y( \, D6 A5 i. ?( W
, v6 ?3 Y: M: T7 }7 _0 Xfunction populate(){' i9 j, D* k- q' P3 D
if (iedom){
' Z, y) [+ Z7 Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- U/ m$ E9 G U! U% Lcross_marquee.style.left=marqueewidth+86 F, m# }8 D& }7 C6 u% B, J4 N1 v
cross_marquee.innerHTML=marqueecontent
+ l/ u, g+ G' T7 ?" _3 |, }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 f! w" ?; t( w2 Q8 s, u* d
}
H9 @8 `; l E4 b! L8 Yelse if (document.layers){. c7 C" c5 n( B7 L$ {6 E5 W \5 ^
ns_marquee=document.ns_marquee.document.ns_marquee23 L5 @) O4 g g5 K4 b5 U
ns_marquee.left=marqueewidth+8( C Y+ N6 V. T5 U2 q) h: t
ns_marquee.document.write(marqueecontent)& L% { c/ L6 p
ns_marquee.document.close()& I3 G* _" Q$ p. n: I' f2 \
actualwidth=ns_marquee.document.width) R3 a+ ]3 m' r: L8 ?2 {3 r
}
% z+ S: @- s* O7 z6 Y3 ^/ Q2 C3 Nlefttime=setInterval("scrollmarquee()",20)
2 |: ]9 z, F! B4 \' L6 f}) V1 I2 S8 j" n& w! w' G
window.onload=populate) z1 {+ Z' A4 ]/ t" G
5 q; K3 g( ?; ]" n
function scrollmarquee(){
1 ?( t9 h' \; W# _if (iedom){
, W) ^" a% x& L( B# u9 o' z6 r7 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
Q# W g0 P' x2 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 j; p$ [% c1 eelse- T# i: R$ u7 R' ~: o& n
cross_marquee.style.left=marqueewidth+8( u1 F: e4 [' s# l
+ z! y4 H) K5 U4 L/ s}
* _6 u9 s, p" p6 relse if (document.layers){) Q# o9 ?* c- j; Y+ y+ b
if (ns_marquee.left>(actualwidth*(-1)+8))2 G5 ]6 k! R8 n/ D, o5 R$ n
ns_marquee.left-=copyspeed" ?, l8 A2 r% S0 o3 M
else: o0 u( h$ I H4 E+ Z# p
ns_marquee.left=marqueewidth+8
$ A: ^ N3 @8 T3 {2 m9 U}0 m! n% i1 k2 g! h7 S
}2 c' u/ `, S) R9 _, N
H9 B' g) p( Z# G6 r$ ]if (iedom||document.layers){9 @8 ?& e( Q; I7 K; J
with (document){3 e) V4 [% T8 f( t r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( T$ x4 t: E6 N. @
if (iedom){3 I( f, T+ ]& ~. V% o) s4 o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' R$ a# d1 T( X1 G% e3 j Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 j" ?: ^3 o7 `5 \' }! @+ V/ G5 W! M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 [4 A; R! a6 ]2 _$ n$ A3 K" ?write('</div>')
$ |* [" \ V7 ]/ y. {}
, Q0 w& z/ T c9 }. A$ relse if (document.layers){# u) j5 {! {) T. o% K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 u! A" @7 B( k. awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): O! F4 O- h, ]4 c2 r, O
write('</ilayer>')
, E8 k- ]4 o; Q; ?# n% t9 ]" n}, @2 C! n2 i" J2 j
document.write('</td></table>'): _$ B& ~, k! x* V4 r* e! Z
}6 n, c) y. K. g# Q
}
7 g: b0 F! }& c4 U</script> |
|