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

|
网页之跑马灯文字特效
//修改宽度
& X2 w: ?. U" Z0 V, S$ pvar marqueewidth=300# p$ v) F: g7 P7 n& E6 J/ ]
//高度
; i0 U# g2 ^7 A2 R& V1 h# {var marqueeheight=25& Q" m; W: i1 q, {3 r" u! l! f
//速度(1-10)2 _ A: Z8 ~6 `1 D/ s3 q, \
var marqueespeed=3
% U1 h4 a" w& d1 I$ |3 J0 v//背景颜色
`3 {% H( m) w0 [! h3 [var marqueebgcolor="#FFFFFF"- H0 o% s8 a1 S' S2 [% a7 J* K
//是否能暂停 (0=no. 1=yes)?
0 _) `6 N* K2 l- x. ~5 e1 vvar pauseit=1
9 C0 g: N/ Z0 X# }1 Y: G
2 `; ~8 e$ Y) A6 Y//修改显示内容
- f) k# P5 u5 U' W" xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 ^0 W' V& x9 [# r: Y
5 j" N0 U1 l q- w3 L6 F; p t6 @8 u' \5 M3 k5 l8 D
////下面不需改变////////////( N4 i$ S% E5 q4 U' b) `8 S* Z' A' c! q
& v/ M$ R& }+ X% {1 {! kvar copyspeed=marqueespeed, ~* c2 J6 s. q$ C, @3 Q* m+ x
var pausespeed=(pauseit==0)? copyspeed: 0: k4 ~& F- F2 O
var iedom=document.all||document.getElementById! L! s* Q; ]0 F8 _- I( z2 I
if (iedom) _/ @9 Y& p, m5 P) U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; Y9 \* _# ?/ j0 H+ I' q3 {var actualwidth=''3 P0 ?* x; Z& c
var cross_marquee, ns_marquee
7 i5 a& {$ H" x( ^+ @2 V0 V
0 L" U6 n2 P& u5 x' w9 M4 p9 xfunction populate(){
' S' s! r) p6 R$ [( v; E, lif (iedom){
0 S1 E5 { a. z Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" c m% Z5 I1 p6 t! l2 ?- Vcross_marquee.style.left=marqueewidth+8
. H4 K, X5 _3 c% d* f" pcross_marquee.innerHTML=marqueecontent r6 g7 w# Q: A; ~, b/ A( u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! B; _ d, R! l/ h) P$ d1 P' h! U}7 [4 o0 \3 n1 @! B |
else if (document.layers){: i2 B9 \3 J w g% B
ns_marquee=document.ns_marquee.document.ns_marquee2( T) ]! C- V% t: A) B8 Y
ns_marquee.left=marqueewidth+8
1 V1 p& |/ _: U" Qns_marquee.document.write(marqueecontent)9 j3 N9 n$ V; Y# ?' q
ns_marquee.document.close()
9 L8 |$ u& V: ^* z& [& q% Y* m7 yactualwidth=ns_marquee.document.width; ]) [, y& y, M# i7 y" P# f
}
2 V. {7 |8 l( z Z1 a4 d# p1 plefttime=setInterval("scrollmarquee()",20)6 I+ H/ _( t1 L& R
}
8 \4 `8 ]7 J8 `3 Q+ `3 K8 Lwindow.onload=populate
5 E( i2 d4 V6 [/ r: ~( r8 G4 f: ~ {4 f; F% b/ m
function scrollmarquee(){
. A8 R8 P2 _- X% D' e; dif (iedom){2 Q6 Z: Y, b+ A0 [5 c8 R& x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 @" w) D: Q6 R% ^$ F( D6 W# C2 {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' v e9 ~7 t3 P: @# S4 y4 Q
else7 X, n$ v8 a1 o1 W* ?
cross_marquee.style.left=marqueewidth+8- K2 W' X" P# g# j" ]' d& h. y
6 s5 n0 l" L$ J}
2 [' b: t3 `8 e, N- a+ melse if (document.layers){5 t: D/ m- t) L0 h3 U, _% \, y
if (ns_marquee.left>(actualwidth*(-1)+8))
5 J9 W7 E7 ~$ @ B* u' _2 X8 c- Sns_marquee.left-=copyspeed
0 u" x; B% ~& melse
5 A$ R: K6 j- x- zns_marquee.left=marqueewidth+8+ y% w, A- }2 v& i/ T& o0 y+ {
}
" u7 s# E, s) d# L6 n}* n/ A& I& [) v$ }2 ~! ]
" g$ ~# U: g ]! Q( N- K
if (iedom||document.layers){
; t. H, ?, S0 A. v: C# J/ Fwith (document){
2 q# X! `( ?. @, @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! H+ F ~8 R" m3 v& A# I6 R
if (iedom){2 ~6 g! M; C9 p/ e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ m8 n' b4 l( N7 l# l( ~" Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' L2 \6 p) e: O" L H- C8 l. `* }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 C* M4 B3 b- |4 ^
write('</div>')
2 [2 f5 u) ^1 s; j3 V}3 \- s% d7 ?' I% e$ g8 R2 E
else if (document.layers){: l8 l' g! ?' V0 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 W9 V2 _: Y4 o, ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 z; U6 \. a! X) X+ H9 ~
write('</ilayer>')
: t6 B/ x1 r' k+ M3 I}' f1 E% C) p& p7 W2 o7 M
document.write('</td></table>')' u. `0 g- }) A* r) w' o$ d( {% `( L7 c
}
( R6 x/ y/ O) g3 h; Q, ~}
9 `/ B5 V8 Z; h</script> |
|