返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ }1 b  ]8 k. Y5 _$ T0 Q
var marqueewidth=300
) j- L) h& B( u4 M( q& V. I//高度( r) E7 n1 f4 d
var marqueeheight=25
) f% @4 u; [- a3 y1 c% v//速度(1-10)
  J# \/ W% [& L, T8 nvar marqueespeed=3
2 M; m* m% F3 I5 M5 ^" V//背景颜色  z% {9 Q6 g) @  d
var marqueebgcolor="#FFFFFF"
3 {8 S* _: ]$ h) R1 J//是否能暂停 (0=no. 1=yes)?
. ^- [9 N$ ^+ Xvar pauseit=1, I, @9 `% [1 U/ {, f

+ k4 d2 C! F0 J+ b5 _! X) p0 }  L0 y% P//修改显示内容6 p+ q# ]7 N: [+ K: _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; p% D6 {# W# X3 }# j3 w' [/ Y% H5 i/ @* L$ v

+ c6 d+ O' ~& V) E1 R! Q////下面不需改变////////////
" B' _  {3 q" M& v9 Z' V9 [- }7 N: T7 W. G
var copyspeed=marqueespeed4 M4 {8 T7 D( o0 W. t- e' r
var pausespeed=(pauseit==0)? copyspeed: 0/ a  x7 Q7 h  ~7 g5 J2 I" `
var iedom=document.all||document.getElementById! A% p" F2 d: L( F( R. H+ S
if (iedom)  \' A2 G6 {# j  i3 l' J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 S$ \+ {2 s0 v! o. L( z! Rvar actualwidth=''4 p$ A) [) ^2 p; m+ x. t4 G+ p
var cross_marquee, ns_marquee
/ O/ I7 e( w, L( G3 `) @6 {7 \* }7 ~# e% A( r
function populate(){
) [# i8 A% f$ V8 U! U( iif (iedom){, R/ A" @+ p( x0 [! v0 R1 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, ?+ }- Q9 ]2 S1 j3 J  @9 s
cross_marquee.style.left=marqueewidth+8
8 x* ?( u0 U+ g( F; qcross_marquee.innerHTML=marqueecontent
) U- j: G& r" x( C& eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: w& P4 V! @9 U}
7 q* K  j7 x+ ]1 z  X& r+ D1 @/ Melse if (document.layers){9 L9 l5 H, p6 H0 @/ S  m7 d
ns_marquee=document.ns_marquee.document.ns_marquee2
1 r$ T, S4 n' a7 t. hns_marquee.left=marqueewidth+8
/ O. I2 T$ K* W' Zns_marquee.document.write(marqueecontent)) I6 `. q4 ]" \0 I! f
ns_marquee.document.close()
0 G+ `# p0 `7 k; zactualwidth=ns_marquee.document.width
; o' H# ^( {/ X+ l3 \; \; T}. x" r. j( l% R, t2 |( K) F# V/ J9 Q
lefttime=setInterval("scrollmarquee()",20)
5 i1 l9 m  S0 q8 w}8 I. a! p( H) d0 y8 w% S. ]
window.onload=populate
1 J8 V+ \+ U  E0 Q5 L" \4 B: C, H& N
7 o  y& f9 s4 {* w! k  G1 Kfunction scrollmarquee(){
0 |3 V' Q+ m+ r5 S4 fif (iedom){
" z2 U* l( @( _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), D: V) k. i9 N. M5 v- d% E% s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; a( ]$ h5 w. kelse5 F. _* s9 m3 e$ b* u
cross_marquee.style.left=marqueewidth+8
4 D4 Z8 D5 }% P6 [; x
0 i  O+ Q3 P+ H% J- ?' z}* X1 m5 B+ S) u; r) K% p
else if (document.layers){
6 F0 P+ E- E; I9 S. M* ^if (ns_marquee.left>(actualwidth*(-1)+8))% X, [6 I: S% p4 C( u4 G
ns_marquee.left-=copyspeed
2 l; R" H! H$ f* ~1 [( `else2 A8 W& _5 ^$ Q/ n/ f
ns_marquee.left=marqueewidth+8
% e8 `. _# n) H  [# P$ F& V}- ]8 I+ d- @5 |4 E" X! g
}9 v. [: g6 n' x. b4 l+ b# N, ~1 q

3 X& T& T, H6 P$ ~" pif (iedom||document.layers){
8 ]: M# Z* J; h& r: p9 Ewith (document){
9 c6 y) Q  E9 l" a- C1 R3 X- kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ Y, e6 s2 Z1 h, ?0 m) eif (iedom){- n* N4 |4 O! L. L+ W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 e0 e0 s/ _; Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 o9 {; Z' ], b& n2 pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 ]% M7 h/ F4 L
write('</div>')
- ~5 p" ?: }8 _/ b0 e& h}
7 `1 }- `& I8 B2 R' Eelse if (document.layers){
2 V! J+ \; `) ~4 Z, Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' [& F$ Z( n9 R4 \! O: s, Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. v6 t  L& ?5 |. ]( m& x' _write('</ilayer>')
6 w" l2 N( w- ]# n) A: g}
( x1 I/ F; ]" tdocument.write('</td></table>')- e. S  I9 f- H
}# i. U1 a, _' s, J+ g+ O' p
}5 B* D$ ^+ l, g8 g) t7 t( s, L
</script>

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