返回列表 发帖

网页之跑马灯文字特效

//修改宽度" b1 I' X& i: s9 R$ `' q7 \
var marqueewidth=300  N- M0 K8 R: X  n* \, T- H9 S9 N
//高度. |7 s3 r, u$ L
var marqueeheight=25
, G' h% l  h! I& E( E: c2 M//速度(1-10), E9 x6 k# j7 s5 s
var marqueespeed=32 M! M/ w) C6 J* s: _3 J/ I$ Y' c
//背景颜色
7 K% b. y$ \3 \- i9 Vvar marqueebgcolor="#FFFFFF". G7 k! E: D; r8 q
//是否能暂停 (0=no. 1=yes)?
% }, n: T. t& u$ dvar pauseit=15 m5 Q, }4 L* X5 X

& U/ ]8 M+ w" v: U1 C( M" Z//修改显示内容8 L$ t# V2 r. x- F% o- ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- |# K+ D/ `, \& j5 D
- m/ k5 c* c" |$ W: k
# j5 M( a+ G( q$ L& S4 J, f) V3 R
////下面不需改变////////////9 }# ?5 Z+ S: O; C' P
5 k, m0 }0 w2 s& P
var copyspeed=marqueespeed' V6 t: R0 O7 |* @
var pausespeed=(pauseit==0)? copyspeed: 0# i8 E  S8 a; T6 {8 Y
var iedom=document.all||document.getElementById- Y$ {! i8 [1 _- _' Q  }
if (iedom)
3 i) _8 G) _9 a) ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- c# R( L0 c+ l- b3 Xvar actualwidth=''
; u- h0 c2 z) `$ G2 gvar cross_marquee, ns_marquee3 y7 y" m6 G* I2 L. r& R5 ?

! }+ q& U& g3 h1 o" s  `function populate(){
8 j9 U9 [* M7 {6 |. nif (iedom){
. c+ s) D* R5 |, k9 a( Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 X% o0 v) G8 Z3 A
cross_marquee.style.left=marqueewidth+8
* W* d0 Q9 p- j) lcross_marquee.innerHTML=marqueecontent5 N- o' ]' j/ W7 ~  w0 }5 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 e0 x* b; z) J9 \8 K+ H4 x0 u9 \/ M9 c}
3 U# U% A8 b& {* K- @& B" F9 belse if (document.layers){
# \# {3 |" B+ S! b' E, Ens_marquee=document.ns_marquee.document.ns_marquee2
% X% E# L) _# ^$ R* Z2 Z+ Bns_marquee.left=marqueewidth+8& u+ L! E6 V" q' `, p; |6 U
ns_marquee.document.write(marqueecontent)! @% B! E# M: _; s2 W. L
ns_marquee.document.close()
; h# M2 b5 B! Factualwidth=ns_marquee.document.width
( q0 w3 r9 n0 O2 V0 V}
" P. [. h5 _  u! b6 i6 xlefttime=setInterval("scrollmarquee()",20)2 l1 h2 R" z5 q* l4 o! n$ X3 k9 }
}
7 \/ _; t' I- H9 X. M$ }% [8 Swindow.onload=populate  s* N9 Z+ W3 U8 Z7 g' k" U% {8 O
9 F2 X; S5 I2 p; ~
function scrollmarquee(){* p, F% m! D- _0 m
if (iedom){) X: d4 q2 X9 e/ Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 s8 k( [; c! e* {8 i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, }9 L9 h3 P! h, Z% ]else- I' |9 i4 c! A# B- n- H  u
cross_marquee.style.left=marqueewidth+8. A: h# ?- g3 ?5 i

; K, {% J$ N8 v! w: ]  }}* E! q/ m4 V! ^+ k9 ]
else if (document.layers){6 b7 b) Z8 g2 |: ~' @
if (ns_marquee.left>(actualwidth*(-1)+8))
+ v0 t5 s! }8 z& e% i- K6 S& Cns_marquee.left-=copyspeed) Q7 f, Z8 ]' c6 Q" t
else# R5 S, \) K& W2 d9 @
ns_marquee.left=marqueewidth+8
6 j, h7 o  }& D4 u& p3 F1 c}- i' F5 A( h. l, g
}
5 v/ M7 k, p) L. E" P
! P5 U7 C4 o: ]+ E- Vif (iedom||document.layers){
' d7 g* `7 n* J9 a& wwith (document){
2 w0 r* A# b$ l& ~, F- bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 f4 v8 g! r! d8 }2 c( T8 k
if (iedom){
! Q9 W6 D  S( H8 e4 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 s! }$ [0 @- f+ Z4 j$ iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  J/ P9 ~# A* i+ d' u& g* W0 g6 Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). c, M; I6 c. B/ O
write('</div>')% ~* V* r* A. V$ o
}
2 n. }4 r) A2 telse if (document.layers){1 X7 `, e+ b1 t; I0 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 p9 g2 S  M! `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" K- H: n) R8 x1 ewrite('</ilayer>')
5 P7 v6 p1 r' W8 @3 o; M3 S& g2 v}
  T5 u2 O+ k/ o* I1 [  z# Ndocument.write('</td></table>')! W: ^2 y) ~' w6 b0 D
}& M" D5 }4 u& t+ C! x
}4 Y2 M# a: y& p, M
</script>

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