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

|
网页之跑马灯文字特效
//修改宽度
0 p2 b; j: Y# ^- \* ~- zvar marqueewidth=300
0 S7 `6 ? k- C% F$ x' n2 P) e//高度4 A. b h. {* |$ X
var marqueeheight=257 `# e! d% G% A- c0 V: c
//速度(1-10)! F; m f" h b" p; a
var marqueespeed=33 I8 {; l, m0 ]; w, A3 Q
//背景颜色
2 v1 _' E* I- a8 q& m) m, }, qvar marqueebgcolor="#FFFFFF"
% e4 S' k& E% j) N# R: e+ K//是否能暂停 (0=no. 1=yes)?2 p6 n- |! x! |9 |' p9 ?0 u
var pauseit=1! O9 P! P- z3 o. Z: M7 V1 W6 @
$ o/ q2 K9 `1 A4 \* _% @//修改显示内容
0 K- G6 `. v+ D j8 U fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 X1 }% R7 J1 X0 K$ O6 N+ k* b# ^
6 L! f3 K* g! P) E# H8 t: c6 Z; p$ i( K) A
////下面不需改变////////////
n5 e/ n B# Y5 ^5 B
1 T* W% k0 I# ?4 pvar copyspeed=marqueespeed
- G4 M. l: ^% q( i3 N# hvar pausespeed=(pauseit==0)? copyspeed: 0
0 T# ?3 w* T" Y; o! ?var iedom=document.all||document.getElementById
) L5 T/ K/ T( B( n# k* X2 u6 Wif (iedom)
( F2 \0 i, }/ g5 W Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ F& W5 }+ N9 S3 Ivar actualwidth=''
$ B& o) b0 i$ z6 M: C- W7 v0 Ovar cross_marquee, ns_marquee
) V s; K9 X. z& N2 X
1 Z4 I; u( T: ?$ L% Ufunction populate(){
, W) M% n% Z8 Y1 ~: ^' Jif (iedom){
! ~% m+ F, o, e8 ]/ M' [1 d6 G! Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ B1 |; A7 x+ q* t+ across_marquee.style.left=marqueewidth+8* k4 _1 b1 d B% a
cross_marquee.innerHTML=marqueecontent
, N( @5 }- s% aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 Z6 f% A0 p( b: E8 u3 n) U8 B! u1 U}' G5 n# m# s8 k0 `) @
else if (document.layers){
* I. [; z# e# \2 r9 j0 Wns_marquee=document.ns_marquee.document.ns_marquee2
$ I; L- U8 d6 k6 D9 |! Rns_marquee.left=marqueewidth+8
% ?4 C: q8 e4 f2 a" ^" {3 {( fns_marquee.document.write(marqueecontent)( c' b( i# p+ G& j" O
ns_marquee.document.close()8 W' L8 u( ]0 T! T5 E2 {$ w
actualwidth=ns_marquee.document.width& F7 y9 P& s" I- l) C
}
$ S8 v( H, T4 Z7 elefttime=setInterval("scrollmarquee()",20)( T; h' h' u1 ~1 d( J. t+ s
}2 _3 D/ V- ?& K4 S# y8 q$ @
window.onload=populate8 E$ g' I; g) E) n
& d2 @; L( ?& C# z( s- u# B2 z% Xfunction scrollmarquee(){( U, u+ c( l2 e* D2 f! a& B
if (iedom){5 e) @3 a8 \/ k+ g l4 R! G2 S' Y( C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; O: W0 S; b; @" Q, n5 S1 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* `* |# S, V; F
else; G1 e7 A) G/ @0 U, e' x
cross_marquee.style.left=marqueewidth+86 z* w5 P, [7 u% U: A8 z, c
% ^/ t. p' v4 o( b}
" w0 } A* L( z9 \else if (document.layers){% ~3 V& ^4 I$ y1 B, W2 G4 g. l
if (ns_marquee.left>(actualwidth*(-1)+8))- z2 y% G" A4 O+ j) ?7 n
ns_marquee.left-=copyspeed
5 G+ u. Y6 m! e q' Gelse
! i# \$ @' B0 o% Bns_marquee.left=marqueewidth+8. T* f {0 D0 `
}
, U8 h3 Q. h: I' ?% N( Z5 z}
% T! i+ [, z) p5 N% x ^
( L2 ]5 q+ k8 J3 P2 kif (iedom||document.layers){
2 O L" V$ l4 D% C9 hwith (document){0 a S: p/ P5 x* z# }" H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 \- S0 ?# A' i) v2 S6 Lif (iedom){
Y# k3 V0 S5 @8 S9 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; B6 X6 I2 s& w& Q3 s: N! i2 b( h. mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ a, t' U) h! B* [9 C; o* p! `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 w2 U) P/ g4 x" |7 L% r$ Y
write('</div>')
5 @: Z! V8 G( f& s3 q% \}$ ]6 b/ q0 z/ T- I4 n
else if (document.layers){
$ V% ]: i) v2 d$ Z: s* @7 R$ Y. owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# U/ j3 @" {8 M3 N' M1 N3 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" V" |0 Q( j! x! q8 p
write('</ilayer>')9 B' h9 }6 J$ U+ b) Q i8 f$ U# N
}+ d F" r, u1 `/ r; V( L* t
document.write('</td></table>')
3 [3 s" L# x {* u C# U}, B! X: {, ~3 O" M# b5 g. i) W9 ~
}4 |6 G: b' x" C. a7 o, @
</script> |
|