返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 p3 @$ H0 k# ^! c+ c1 Q5 R
var marqueewidth=300
$ s3 a$ F  q7 X9 v! Q' Y5 e5 H//高度
$ E' z* P2 j( |. kvar marqueeheight=25
7 A! `8 q' `0 O$ f) W3 e' \, C//速度(1-10). j7 c2 d# H  }4 U
var marqueespeed=3, a+ M$ p0 R, }9 p6 W  x! H+ q# V
//背景颜色
1 j, H; N" X2 J. W% G  @6 n, avar marqueebgcolor="#FFFFFF"$ g$ B' e6 Z. j! _7 c
//是否能暂停 (0=no. 1=yes)?
: C; }$ F' ~' e7 i, d& }var pauseit=14 Q/ i' |: ^) [9 `" B

/ @& D' F8 g! j//修改显示内容( |# `8 V4 A2 ^2 g1 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% ]0 o$ R7 |% ]! i2 U
7 N: ]5 Q0 y* Q! r1 w& H. F

; o  q6 a7 C  a  a////下面不需改变////////////
! ^3 j/ u3 K  J# j: y
2 U* N. c$ \; N; M: F0 m7 V1 o9 Cvar copyspeed=marqueespeed
5 q7 Q/ E* B* J% i- lvar pausespeed=(pauseit==0)? copyspeed: 0
4 ~' U4 T& O/ E5 m8 v. Mvar iedom=document.all||document.getElementById" h5 N$ d- h+ X# K
if (iedom)
4 s! f6 y" r: P5 |$ Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# z0 l, w) m: S$ j0 m7 {0 V* ivar actualwidth=''! _( W/ n! k2 J  `5 Q1 @  b' N9 S' m
var cross_marquee, ns_marquee# e  e$ G2 Q1 U8 q) {  i& a

2 C5 ~6 ~( B$ b; Y8 Yfunction populate(){( w" T1 \+ S9 N( E. P
if (iedom){
) \2 `; a9 ?# G+ Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* n" \$ F" ?$ H. X0 _7 X) Ncross_marquee.style.left=marqueewidth+8) Z( \: q) F8 h6 i% t; x
cross_marquee.innerHTML=marqueecontent" ?: J; ]) l* }1 p* t' l3 q# H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# E7 t, E" k1 D9 h& J}
  M# G! Y& ]; celse if (document.layers){9 f+ z& b6 v4 ^# }
ns_marquee=document.ns_marquee.document.ns_marquee2  Q: i' ?6 Z7 Y5 E# A
ns_marquee.left=marqueewidth+84 O. C( r& U5 F$ N7 x! ~* ?
ns_marquee.document.write(marqueecontent)  z$ c; d; [) E, k0 A) R- S! l
ns_marquee.document.close()( e3 U+ C. H$ @5 f  _
actualwidth=ns_marquee.document.width
- h" B$ R3 Q" U( `; L}
# q; |" Q, D1 Y5 Q2 e; B1 p( o8 C( Blefttime=setInterval("scrollmarquee()",20)
' Z6 x5 g7 {! A! b+ q}
, R' v9 I5 p: u) ?3 Y, ]; ?window.onload=populate' i+ x1 O0 q( Q
2 v0 S5 V; Q1 B5 ?5 u& p# T" P
function scrollmarquee(){
2 i: c$ P8 }7 ?4 k$ Vif (iedom){
6 i& E( t3 F. u. s8 y+ Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 k5 P" u) K; k" I2 m. e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 S' c! }- B/ V& P+ I; E
else
( W. Z4 d! Q/ y7 Q; W7 Tcross_marquee.style.left=marqueewidth+8
/ I1 S! ^1 P* m& J! w  i& p1 z) ^0 K( K+ D' U. N  q
}
( N. C5 U# g' S6 [; welse if (document.layers){
$ \- E  R9 O; |! Mif (ns_marquee.left>(actualwidth*(-1)+8))+ G# a5 ^5 Y5 U3 C. U& f
ns_marquee.left-=copyspeed6 p0 Y: f3 |# c( \; F' v
else+ V/ K" a. H" g9 i* Q. ?
ns_marquee.left=marqueewidth+8* s3 o7 _& U5 n( K, I' Y( |/ q, G$ l. s
}6 n. [% J) F' b, ]1 R
}
! G  q# ^$ k9 f3 q: ^- w! ]- n( F0 j* g/ T  G; g% E
if (iedom||document.layers){5 ?4 o& O0 N: Y
with (document){
' ~0 b% T; ^8 D6 I& b1 \# Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( j1 }. K% R) q. |2 }7 Y$ z$ wif (iedom){2 z. ]1 p  |) t' l& ]! ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 E* F6 Z5 u  c0 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  F' E( j( T5 s" t( U! Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) D! h! m* z, P% ^6 L, pwrite('</div>')$ `2 \9 N" q! q; q/ U+ _
}
6 d/ m, Z/ I: g0 velse if (document.layers){
1 E8 c$ ]( Q+ d8 B8 u! i) ~" bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 j) w& a( f9 A
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! w! k  W8 B* g3 a" g5 y
write('</ilayer>')
% h! t2 }1 K: k: _* }3 G0 X# X! @}0 s2 T, f- ^6 h* `  W# f/ R& q) r
document.write('</td></table>')5 c6 s& w* F# z) N, ]2 Y
}. K! X) G7 ], J. k
}
; E; W# ^. t# @7 T, u</script>

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