返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) J( y6 W  O) w' ~. p) cvar marqueewidth=300
& g+ \9 _# o  B! O% c4 r1 {//高度# Y6 G3 s; Z3 F5 m# n. [
var marqueeheight=25
" j' ]: ?4 M1 U8 m1 F8 F: B//速度(1-10)* Z6 @; ]% y$ r3 D
var marqueespeed=3  G7 `& L9 i% k) ~: z( @
//背景颜色
, Q5 r7 F2 s9 o+ |: Hvar marqueebgcolor="#FFFFFF"
2 ^+ z4 C" Z1 N7 f//是否能暂停 (0=no. 1=yes)?6 u- B/ K! f  M; K0 U
var pauseit=18 q! C' z6 Z3 F; q$ F

9 U7 _% V2 `! }; z- P* u+ Y//修改显示内容
4 p( R$ x: v7 z7 y0 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* w& [9 B6 g% c: O; ^( D$ ~" l

; V3 _% \- U5 f* K- _* u3 q+ L, \2 w  P  s' z3 y7 O
////下面不需改变////////////7 L6 [, U5 ^' W+ k
0 a9 u+ h. ]$ D' K: p
var copyspeed=marqueespeed
( j( k) o) o  m1 I6 ~$ W) e7 rvar pausespeed=(pauseit==0)? copyspeed: 0
* l4 w! X( _' V# G8 y, c7 lvar iedom=document.all||document.getElementById
* V& j" P4 `3 L$ Pif (iedom)! A  Y* ~" L7 }/ ~  {# G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 t$ t" m8 T: u9 r9 }6 Q8 U( |var actualwidth=''
# H- O* j& e; Y8 ?$ o& R$ ivar cross_marquee, ns_marquee2 ^" m- G1 p$ Y

, T8 |! F3 M3 @& Ifunction populate(){
& d9 ~4 f$ B- K9 wif (iedom){
  E4 ^* @& w" x, D0 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- x( K4 \  b$ m  r' lcross_marquee.style.left=marqueewidth+8  M% U2 ?2 d/ i0 q' X5 u; r6 v! |! ]
cross_marquee.innerHTML=marqueecontent
: {& {. h5 h0 c( e# _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 Z' ?# f/ K: V" x% [& B. C: Y}
5 r, y0 h/ E& n0 J$ @. welse if (document.layers){
( ?3 S( }2 C# a: [ns_marquee=document.ns_marquee.document.ns_marquee2
2 N; N9 B% {, ?+ r: |3 Nns_marquee.left=marqueewidth+8
/ F- J: N* Y6 A- n2 ~$ Uns_marquee.document.write(marqueecontent)
( g" B6 S6 J% z1 G4 ]ns_marquee.document.close()4 `% h& a4 ]- N$ h  d7 z7 l
actualwidth=ns_marquee.document.width" M  h& D; [- [) A' g5 |) e
}
* V' s  z" Z; V+ s8 d* @lefttime=setInterval("scrollmarquee()",20)
& y5 [; H& n2 X, s2 D% T}2 W' M5 K- L: G) n. s4 A; b, |) n
window.onload=populate& p  c  Y. ^! P" S

& Q2 g( B4 B" \0 `) sfunction scrollmarquee(){  O. ]9 f9 b: t) V
if (iedom){" @' Y4 u! c4 b1 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 p- W: |( [, k. H6 y) B. i0 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 l0 b; G5 F; }else
9 {: t. q- N& a* Jcross_marquee.style.left=marqueewidth+8
/ L- g6 B9 X( \. a, \7 W, Z8 d4 ?% w* K. m( X1 }  I
}, w7 {4 A( q- U. E: @
else if (document.layers){' m' C4 @; Q# d
if (ns_marquee.left>(actualwidth*(-1)+8))( t; ^2 `9 {* h+ U9 L! k
ns_marquee.left-=copyspeed
$ N' ?& l6 \( e0 q5 ^else8 P: }5 Q) R- d
ns_marquee.left=marqueewidth+8: g( z0 f1 }. z; w1 Q5 r
}
( j% J0 h* Z$ K  E! E1 @6 |0 O}; f* E' H' I6 P

$ Y0 Z( W2 z" pif (iedom||document.layers){6 }" x2 |, L9 [# @5 f5 m& i
with (document){
  p' z5 G" S9 Q5 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" i# B0 o8 P' @# E) d' P
if (iedom){
8 m, M( G9 K! H2 w( @  P5 d" `% ^8 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& t: i1 N1 h6 R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# D: l9 M, V8 X$ q$ Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ I, B# z0 _, e3 [4 a! {
write('</div>')
" H! m% `( V. i  D+ v( I}( E# v# \4 g. ~) G
else if (document.layers){# }5 ~! v* H2 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 z8 O0 |. {/ J# u+ a7 g, Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 w3 h) {4 K" J  Z( ^; v2 Y
write('</ilayer>')
, ?; ?  d" G' ]8 ]% o! u1 g. Q}" X% P. t) C( r" \) a  ~) E
document.write('</td></table>')
$ [* `; a7 k" u! y/ [}
1 G6 M- V; @% v% Q/ p8 C, S4 @}
+ ]& |7 v2 K  z+ G$ |</script>

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