返回列表 发帖

网页之跑马灯文字特效

//修改宽度& |9 z# x/ G) C7 t9 C, ?
var marqueewidth=300. K* J7 m5 c6 ?3 J1 k$ U2 b
//高度
$ h9 N" h0 _7 W5 g4 Xvar marqueeheight=25
6 m( v/ R$ H& B  Y9 m1 Z//速度(1-10)
4 t% T" A# Z* Q; u8 K! d7 |% R6 Rvar marqueespeed=37 u9 n' y5 H8 Z& Y7 Z- z9 B, L
//背景颜色- G0 k8 ~9 ]% F
var marqueebgcolor="#FFFFFF"! l5 |( ]! n# Q6 h# G3 c1 ?6 ]) u
//是否能暂停 (0=no. 1=yes)?0 }; z' l; R  K- C, n% C
var pauseit=1
3 N7 S( S( V3 l* d' ~
8 l/ D. y* ^- y& y( U$ N2 q* U9 z//修改显示内容
7 I1 \" m$ G& h: U. U/ Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 [0 _. {$ H2 g* E# T0 h
+ A& D, G; U- m: [" M  K7 |1 @  P/ J7 B1 ^# {
////下面不需改变////////////
- E3 t3 v# T0 c1 F& b$ C. |) R, |2 [
var copyspeed=marqueespeed
, O5 R2 Q. X8 w' J9 T6 @var pausespeed=(pauseit==0)? copyspeed: 0+ Y8 o* }0 p8 j% t7 `
var iedom=document.all||document.getElementById3 Z! G7 X) U  j, ~" t2 H* `
if (iedom)
2 W! @& E1 [, H' Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) g$ w( T- N1 p' }9 V& @
var actualwidth=''
* ]: o! P+ d: L5 C3 ?/ q8 i/ y3 Tvar cross_marquee, ns_marquee$ Z# g( Z0 e% k' P
! A/ K2 P/ b3 i# Y2 c
function populate(){" x8 X  I( a6 w# C7 n
if (iedom){
( f) |1 ^2 |2 h! ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 ^1 Q% y: a1 k* Jcross_marquee.style.left=marqueewidth+88 ]  A) ]/ D  U1 X! k; B
cross_marquee.innerHTML=marqueecontent
$ R, D. S) \. N0 Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# w+ N# B2 |1 u" M
}
9 d; n# C6 Y6 k% g7 B% _! a; v0 velse if (document.layers){
% s" e$ F3 @, j- i5 J% ens_marquee=document.ns_marquee.document.ns_marquee2' o' _$ Z; L( p9 |5 w0 j* p2 i
ns_marquee.left=marqueewidth+8( @# W; M6 Y* _9 X# m
ns_marquee.document.write(marqueecontent)" v0 w) I! _8 J* [3 R& Z
ns_marquee.document.close()9 H! m4 i0 S+ E& u4 t8 z$ x
actualwidth=ns_marquee.document.width
* K- M$ w2 \% p. M2 Y, O6 H( E- V}
3 Z2 p# y  O" Tlefttime=setInterval("scrollmarquee()",20)2 m2 h* D+ E3 S/ n# A
}
7 E2 V2 Q- V0 D" R4 ^window.onload=populate" ?: J2 W" q: @' j- {5 J

2 Y& x+ Q2 j1 A2 A5 l/ o3 U' bfunction scrollmarquee(){
' ~% M0 x. `7 w$ O3 Oif (iedom){* |) \! ?- l7 }/ W2 L0 O7 G* L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 j1 x) p, o( O: k5 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 S7 [! w5 `. V) |% s  F0 j/ belse( B8 r  r8 r" s. C% v+ B
cross_marquee.style.left=marqueewidth+8
1 J0 `0 w/ A' W6 P9 j( z: r/ L8 j" m+ J. e6 a9 c6 \  F: z( r
}
1 B- _3 v* x; s# f) Qelse if (document.layers){
  j: s8 `- T' q  K5 H$ s$ y) [if (ns_marquee.left>(actualwidth*(-1)+8))
: Z! q5 m- }8 T/ Ens_marquee.left-=copyspeed
; _8 n& O7 H. H" \else; A  o9 I" `- ]. \- y1 ^
ns_marquee.left=marqueewidth+8
( U3 n+ |, l" Z}0 A* F$ I4 R& z- D# t0 k3 Y8 W
}
$ h6 b7 n8 [+ [/ U/ C6 y1 B9 N! F! D4 M: h/ C
if (iedom||document.layers){8 i! }* v8 e8 c( A/ A6 m4 O! t% i
with (document){
. v% \% P5 i: edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# @2 G" O: ]. }2 Bif (iedom){
* e, n$ H7 r+ E, E& Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 ^5 w" L, B: w3 i" T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& r1 b8 z. N* |' I* o8 P  b' S5 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 [  a9 }+ U* Y: `write('</div>')
& y3 O" c4 J, R$ }3 D}+ D6 V6 O  b% I' |
else if (document.layers){
7 C! [* ^# o! kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 |3 G3 k& O2 y7 b* c9 t1 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 A* U  S, @/ ^4 mwrite('</ilayer>')
  k. F6 Y2 I* h8 g+ d}
! x; L' s' ~- G1 U& Mdocument.write('</td></table>')0 o) D4 u; w$ `, N5 i& @* i: m
}
* ], y1 B  D. Z2 U2 Q}
  T. I& g, s2 X2 T6 a# |( x</script>

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