返回列表 发帖

网页之跑马灯文字特效

//修改宽度- K( b6 V/ Z' m4 ]* [2 }
var marqueewidth=300
! T4 A9 y1 o0 k% M0 F1 O1 u//高度
0 z$ }* a  u1 c; D! p$ H, {: gvar marqueeheight=25! a) F7 e5 @) N
//速度(1-10)
9 i) [8 J1 w. e$ V$ ~7 u. c# Rvar marqueespeed=3( h! {% d+ k+ g5 M& I
//背景颜色
1 l+ l  b) k/ ~# gvar marqueebgcolor="#FFFFFF"
- {) }( `# b+ G" f//是否能暂停 (0=no. 1=yes)?1 M& W# q3 @  ]$ e5 Z7 a- J
var pauseit=12 C0 L" D% e: D( v( H

% `  N1 B+ t% `6 ?$ m8 a//修改显示内容( @. C# n! m. u" j) P, _/ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* m$ [# D( W% B0 N! i! ]
* A0 }1 y( J0 G6 A. T# x5 X
3 m' ~' N0 `8 b3 S+ w& D
////下面不需改变////////////2 U  ^% p" T0 r+ n8 J# n& |

) b/ p7 b, P8 G4 b  \4 `8 Mvar copyspeed=marqueespeed9 G* K' P. B& U8 {
var pausespeed=(pauseit==0)? copyspeed: 0" T7 Q; a3 _; O7 }  V
var iedom=document.all||document.getElementById6 l  _1 e9 `5 R! E- p& p! R
if (iedom)
  J9 U4 u; ]4 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! E7 \# j3 N% l+ h- M7 d
var actualwidth=''
- d. b1 g7 m! ovar cross_marquee, ns_marquee; V4 x' f6 Y' B
9 n4 U9 \  B5 z% P* V) f; i9 V
function populate(){
7 R8 y1 B6 j8 `* y5 d6 B! hif (iedom){5 x2 u5 f; Q" {; \& r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ ]2 n; c3 {: M- p! b  b0 Ecross_marquee.style.left=marqueewidth+8+ U! ~5 j! ]2 E' M& n  n  Q
cross_marquee.innerHTML=marqueecontent
* E% Y/ E4 b5 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) s% x6 h9 p0 u- r/ S0 w}/ Z0 i( a- n1 Y8 i
else if (document.layers){
" d  `! a* v8 ]  |ns_marquee=document.ns_marquee.document.ns_marquee2
3 f) x+ S/ \' g1 Gns_marquee.left=marqueewidth+85 d4 |1 O; C9 y
ns_marquee.document.write(marqueecontent)
+ e5 |" M( }' f- M4 Pns_marquee.document.close()3 Q5 A* O# v% d9 `3 O' A) ~
actualwidth=ns_marquee.document.width
) r3 }+ x1 K7 ~( @1 x! l}
2 j$ K3 Q4 F1 Klefttime=setInterval("scrollmarquee()",20)  @. S% ~! d2 \# u$ Q9 q
}
) v& q: ?& p; ~! b+ ]+ v/ R3 Mwindow.onload=populate: y9 t! j4 M8 {2 s$ Z$ o2 @5 X1 B0 Z

1 K  q1 e# @- T, K. _( Qfunction scrollmarquee(){
* g2 a) K1 d6 g0 b. Q& |" Pif (iedom){
8 s( ^0 y3 A( Y5 Z3 Z& }$ Z8 [) @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 G' I1 i6 x+ ~" }: Z6 x7 ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- d7 _9 R6 r9 ^" uelse
& P8 A) T/ ?/ fcross_marquee.style.left=marqueewidth+8
& u) k0 H4 ?9 U7 z, Y6 f
* K9 l. \( s& v; [( m' d9 j. u}! L; \5 F7 u+ h' {- m8 K& K/ _7 w
else if (document.layers){
) b/ P; [3 A9 Q4 R" ^/ Vif (ns_marquee.left>(actualwidth*(-1)+8))
7 R) d: H' P% f1 qns_marquee.left-=copyspeed
% W- J3 |8 ?6 h- _1 l' uelse+ Y# A; t5 q+ `& b2 G
ns_marquee.left=marqueewidth+8
$ R2 n; c9 K7 Y  _2 o}
$ j1 T) c* ]7 C# R4 O0 x}( s  [/ f8 O7 v+ D

2 h- K% \, c+ E2 J9 z% Wif (iedom||document.layers){
+ u0 a# f/ u7 J/ r- mwith (document){
  s, d& Q. j, l9 d8 Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ Z# K, |/ v7 R9 H2 P% [
if (iedom){/ A) h! n  E0 ]& t. R4 r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). }) L; ?- \% S8 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. I7 _7 O3 ~8 ?1 J2 Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' D. K5 f- n( Qwrite('</div>')3 G6 p9 n, O8 _& T/ W2 ]+ Z
}
" [$ n. M$ N" melse if (document.layers){/ Q: W2 y. E8 u: _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, _. w. F' f, y: Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P9 s$ u8 M! j2 Y9 Q
write('</ilayer>'): K& g- R0 g" Z/ h5 p' x
}% [$ a4 B  p& ]+ P
document.write('</td></table>')
+ B; P! Y( S7 s- C7 C, A/ O5 k* g& j}6 N' m+ ]/ n; ?( p8 X; A
}
1 q  e1 C( A* n4 P</script>

返回列表
【捌玖网络】已经运行: