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

|
网页之跑马灯文字特效
//修改宽度' I( Z8 ^2 i, Y$ Q; |5 f3 z7 P
var marqueewidth=3001 o' |9 A. ]# [7 L$ L' j9 k
//高度
7 J2 r8 ^+ Y* O( Rvar marqueeheight=25
9 {5 H* ~3 I: O1 T//速度(1-10), |, N# o* X9 j; N3 x. z1 {
var marqueespeed=3) o- t' F- c2 a' F. h' q/ M
//背景颜色$ `% D" J( |, V/ t# y
var marqueebgcolor="#FFFFFF"+ K6 l7 z8 m; w, I& o: E
//是否能暂停 (0=no. 1=yes)?
* f& s, A4 {7 n, E- jvar pauseit=1
# N) o7 \4 V# G" k4 @& r& }2 c+ T5 e- k$ x0 ]
//修改显示内容
6 g% Q s2 h1 V3 k; Z. ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') w3 k2 y0 w" p3 ^+ c' z% p
3 F, U; F. u6 Z+ q4 e9 ]# k# B- l: a* N- J3 Q' D% X* X1 @4 ^+ n& R
////下面不需改变////////////: P. q( n1 Y1 R
9 P% M; q& _2 E, g8 q3 S: H; i
var copyspeed=marqueespeed
9 f, P8 Q( ^; l; r: e- }var pausespeed=(pauseit==0)? copyspeed: 0% a$ t& _0 \" N5 V1 A6 h$ B1 I
var iedom=document.all||document.getElementById6 F( Z( e2 A; {% U4 x6 M9 C
if (iedom)
" P4 s2 J8 M5 N- Q. b: C- j. Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: ~* `! n9 f; r( i) Y( Z* mvar actualwidth=''
! |5 D) T! I* V/ gvar cross_marquee, ns_marquee% l5 g/ N" ~) h; Z
* G7 q, `! g; h* X' h
function populate(){
4 e; w7 E1 T( P4 rif (iedom){
+ X" v; j1 v1 G; s1 H; Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 J8 H/ o2 {7 a1 B4 h! `8 Pcross_marquee.style.left=marqueewidth+8
9 G% |8 G6 e5 v9 H' `# rcross_marquee.innerHTML=marqueecontent
* q/ [2 k7 R7 V W3 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- m& y6 o+ a/ A2 T+ n& h$ |1 D5 I
}4 G' T, `/ i1 o+ l# C
else if (document.layers){
& N6 T! A0 Z3 U& P' Y j' D! Xns_marquee=document.ns_marquee.document.ns_marquee2: Q9 c+ V1 r {- B' {1 U, |
ns_marquee.left=marqueewidth+8& P5 Z$ b; F& H" \
ns_marquee.document.write(marqueecontent)" x% R/ h. ]0 L4 B6 H! E
ns_marquee.document.close()8 ]: ~( h# n5 e Z0 B( f
actualwidth=ns_marquee.document.width( c, `! T. M9 M7 k
}8 G$ u; Z" e+ N0 v& k
lefttime=setInterval("scrollmarquee()",20)- C- r7 ]6 k( M. s' U- I
}
2 F' e( H/ i* B7 c# N; a1 Uwindow.onload=populate
, W2 \6 s' Q, F( ?
1 e( Q# t9 G: p! e; A. g7 \2 k2 rfunction scrollmarquee(){5 O0 W$ @8 c( c9 y8 V. j2 n( A
if (iedom){
9 z& @6 M) y# Y3 V2 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, @9 e/ k. J' n+ ?% ]; q# k' Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 {% ?! l6 L2 {! t( y
else+ ?3 Q7 Q: r7 h- E" [" S3 [- E
cross_marquee.style.left=marqueewidth+8
! A& F4 k2 j. u2 ]
+ u! p6 U' M3 n9 V8 D. O# O}0 m1 L0 ^2 m6 b% l9 B
else if (document.layers){) L8 J6 v R) o+ {& P& P
if (ns_marquee.left>(actualwidth*(-1)+8))
" G$ R2 E7 q: \. \/ r6 H7 W8 dns_marquee.left-=copyspeed
! M% o: H: M* Y) gelse
6 e2 J- b: w" a( Bns_marquee.left=marqueewidth+8; v) A( Q- `6 Z, j" T, M5 E
}0 F* J* Z+ ?; {1 p/ I9 M
}
& I x* j- T' c/ _4 y8 h* f1 ?8 e8 [6 X% @/ N
if (iedom||document.layers){
$ ]4 q$ Y( N9 |! P7 Ewith (document){1 x. C# @0 `/ F Z& m' O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# k$ M A7 d) ?# U* f( pif (iedom){
+ h/ {5 V, S2 i8 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# E8 u+ G2 @) k. c" b/ xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# k& N& N" m( x4 D7 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); J, x3 `) m+ y; |& ~" M6 k
write('</div>')
h; |$ E" Q) u8 y0 ~# Q$ F}
# d5 [7 G$ ~# [* a( x7 q, a4 Celse if (document.layers){
* E+ W: Y/ S; `% \0 ~$ {: D$ d; Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ o. O+ _ m9 C5 ^* L* U8 \ twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( ~7 T6 _; f) A! P, r& d% f2 j
write('</ilayer>')
7 C2 ~: P( O0 q} k6 F+ @! m( C; u- A A
document.write('</td></table>')- I1 t' Q% D$ y! X: v1 k5 t* g
}
) v' W, F0 T4 r# H}8 B) Y4 c/ A" G( ?1 }
</script> |
|