返回列表 发帖

网页之跑马灯文字特效

//修改宽度# S4 G( j2 \+ ?1 g' Y$ v+ V
var marqueewidth=300
) ^. W2 E: f& V2 F0 }) i//高度
3 `: V! I: p0 N5 L+ Z3 yvar marqueeheight=25
. v: W+ \9 l3 z: `//速度(1-10)
% ~% r; ^! P- u3 @% ?4 ovar marqueespeed=3
2 Y8 k( ~8 A2 i% t2 a7 c0 j//背景颜色; N# u0 \0 P, S: E0 q
var marqueebgcolor="#FFFFFF"8 b% k- L  Z4 ~3 A+ U1 E# x: n
//是否能暂停 (0=no. 1=yes)?
4 [. W2 f' _; C# U- D* z  {: Evar pauseit=1& I) I3 b; r7 z

- a( l+ ]; Y, `4 Z* r0 j2 e//修改显示内容
$ Q1 K& J7 p  I# e" q: Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 O# [( `3 k& m5 O& C% Q" X
1 g+ d" ^' J. V) ?& `8 F
( p3 b9 ~3 Q9 Y! C4 w
////下面不需改变////////////2 n' V- W( F$ {5 Y5 K) f
' q( a% X3 n2 k& C
var copyspeed=marqueespeed
8 N& c4 |- ^) W8 \var pausespeed=(pauseit==0)? copyspeed: 0
9 _; z$ V: \; s. t, Hvar iedom=document.all||document.getElementById
7 y3 v, S8 t) J9 ^& K2 zif (iedom)/ Z0 f! O! A4 r- a' u" {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 ]" B, |& Z8 t7 K
var actualwidth=''
/ i2 g! B; p+ F9 Gvar cross_marquee, ns_marquee# p. {, K: h+ n; i# D( O  S
5 |1 n4 e2 n* M( q) J- S% D
function populate(){
4 d: m9 b  P8 z1 o  x: fif (iedom){
7 c  K. L! S  K9 z: ~5 {- }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 D  c$ k4 Y8 p* A
cross_marquee.style.left=marqueewidth+8
+ l) t1 M* l# _9 n/ E2 Ycross_marquee.innerHTML=marqueecontent# r) f  \* U( i" Y$ k8 B! H, y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  t8 l& {9 I2 z& ?8 g! r+ B$ Y}& K/ a3 I  U1 N! }; y2 S; h$ H  C
else if (document.layers){3 ~+ i/ K! K! g4 |
ns_marquee=document.ns_marquee.document.ns_marquee2
8 {1 P8 t( l. S# l7 Q) }ns_marquee.left=marqueewidth+8
( U5 z% }4 I% p4 N# @7 |" dns_marquee.document.write(marqueecontent)
2 _/ Q. b+ |& d4 R3 E* @ns_marquee.document.close()" c! M! ~! Z9 V% Y. J7 w* _
actualwidth=ns_marquee.document.width
" f' k, g2 B  b}
# D+ n5 j$ P# S( w7 h2 ], D4 Qlefttime=setInterval("scrollmarquee()",20)* z$ [* [" S0 n4 ]4 H  i
}' D1 ~2 w$ w0 V9 s+ |; Z
window.onload=populate
( L0 L. N; B/ Y$ V' E
" t1 t0 m3 F5 d$ efunction scrollmarquee(){' O5 X4 z$ m5 Q  H" J
if (iedom){
, s; A- o% y( r! Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; a$ D$ w- Y- W/ h$ k9 D* Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: W; n# e  z" G7 d' Z
else
& L/ r' C6 V) y3 Q: n0 ^cross_marquee.style.left=marqueewidth+8
4 U' f1 @$ F# q. w/ x* m( J* J6 P+ B" y' H
}
8 I! I3 K" w+ L0 d7 G  r: s1 }else if (document.layers){
- E; H0 t3 I  n3 H: _4 k/ `if (ns_marquee.left>(actualwidth*(-1)+8))
" r2 @, H  D/ P: @! Z$ }5 r6 {ns_marquee.left-=copyspeed
- |6 w4 _: k! {9 `. ?8 Xelse
0 b4 ~7 p* t/ s* `4 yns_marquee.left=marqueewidth+8: L4 F3 s# N9 {! J" L  c, I0 B
}
9 u4 J2 ^9 M+ z9 h2 f}9 V" _% T, g! X% v
. y# s6 e; B2 L: [. |
if (iedom||document.layers){
( Q( z9 ~2 m" t: a! G8 Ewith (document){
3 ~; v& Q; a; _) G! w0 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& T! _2 u# Y* i. pif (iedom){
* E3 ^: o$ b6 |  zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 Q% B5 V1 m' w/ `0 B7 R1 |  x* G3 D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* v- B3 \" y- L) Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' r* S7 U, P! }1 x" l9 d2 @write('</div>')
* u- J! o  ?; ]* M}
3 ~" r, A+ i; O" X8 `% H9 n/ Welse if (document.layers){
5 W1 d5 V. @/ e1 F8 c* _# ]0 u/ Q: Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 b0 e/ j; W' {  f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), e, z4 e) b1 ]$ T3 Q3 s
write('</ilayer>')! b' V# _- H1 d+ {
}  D' _' ?5 [' y- D
document.write('</td></table>')& W1 a8 _8 n6 U
}. Y; b* \* C! q
}2 {) g5 o: c# q4 c- \
</script>

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