返回列表 发帖

网页之跑马灯文字特效

//修改宽度) E" F1 b$ y* e) W" C7 j
var marqueewidth=300- c6 L* e, f# l0 v+ {
//高度7 C  \5 V( @3 B3 D! c2 f
var marqueeheight=25
9 j/ b& L: |$ i3 c2 G//速度(1-10)% v, T7 M" \% [$ S$ c) j" q
var marqueespeed=3
# T& ?3 V8 `+ G# c% i/ P//背景颜色
7 \# ], Y, m3 c- g" G. `" E9 f6 pvar marqueebgcolor="#FFFFFF"
9 c( x, o5 j- c7 g* d" D/ h0 _! i//是否能暂停 (0=no. 1=yes)?
+ r0 `8 R' |) D# fvar pauseit=1
- y* R& E. a7 {
+ @7 H( o$ r! s//修改显示内容
) d6 N5 q; z! G" Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 e0 ]: {5 q2 z+ `, }3 n6 p% T  F2 A

# k8 j! z' K; x. |5 \////下面不需改变////////////
+ m4 o, r! L0 c# F6 N) R1 C0 N, r. |$ R7 {+ a  g+ |
var copyspeed=marqueespeed
* M: f$ c& ^* c* Evar pausespeed=(pauseit==0)? copyspeed: 0
3 |# D. @, o2 B( {# }# L3 @" q% B" Mvar iedom=document.all||document.getElementById
% s" q9 {/ h; a* E" H/ ^if (iedom)
6 |% t1 A& O; q" h( E4 @0 r0 ^1 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 E/ \# S# A! p% g  p, w# Hvar actualwidth=''
% \% X. t) q# ovar cross_marquee, ns_marquee- \/ G5 K' ]5 o0 V/ n" y
. F# D1 ]1 k( z  Y, {$ ^$ ^! O
function populate(){
- p/ z  @0 e) O$ S% j% E4 Sif (iedom){! n3 K# T9 e! ?, T! r" |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 i; s- D3 S/ d/ C
cross_marquee.style.left=marqueewidth+8
' y% \' o8 W! K- C9 ~cross_marquee.innerHTML=marqueecontent
2 m0 a& ^, M- h4 x! i2 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 h$ r* a2 s# x- K$ X7 w' ]! g0 a
}4 J9 K8 q$ K: Y/ Z4 b
else if (document.layers){+ e/ Z9 g8 }. H' n$ V
ns_marquee=document.ns_marquee.document.ns_marquee2
: \$ V- ], i3 z% j7 x  z4 V* lns_marquee.left=marqueewidth+8) k* ?  L( B, V( o5 f0 i
ns_marquee.document.write(marqueecontent)4 C& c* f" O% r
ns_marquee.document.close()# u4 s) b* z; z# o
actualwidth=ns_marquee.document.width
/ @% C' u# j# C; d  J/ r; |}& W. A# o( @' u3 P) V9 `
lefttime=setInterval("scrollmarquee()",20)' z" e1 b7 m) t* l1 A  ~3 x, n* s
}  ]/ [6 o- j+ G
window.onload=populate# |, Q$ P1 V. c. y8 ~9 n( E
8 K# S- g* U7 q3 {4 \
function scrollmarquee(){
' L- ~3 q6 V! c: E4 f- |& k" Rif (iedom){5 K+ ^5 ^5 Y+ `7 S1 d, q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& q" T  k9 S: m1 g& Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 }' Q$ o0 u6 O; z7 v% S3 Oelse6 s8 Y3 x. u& q( V. y
cross_marquee.style.left=marqueewidth+8
2 o8 b' ?8 R" W5 u. o, J) _% |; A1 D$ m5 [
}, `/ Q; J" |7 h  V2 q* t
else if (document.layers){
/ p/ P+ H# q  L! G; p# H7 Pif (ns_marquee.left>(actualwidth*(-1)+8))
8 y$ F8 q% b4 s7 i) nns_marquee.left-=copyspeed* Y& E5 m; R) ^! D* F
else- x. t1 D2 B/ H3 ^5 B$ U& {
ns_marquee.left=marqueewidth+8$ J$ C( q7 q) X( m/ K
}1 f: x% ^8 Y2 m( M* J8 |1 ]5 H" [
}
, M. `) j  e" z2 e1 F: a+ V% a5 O. x5 s6 U9 p
if (iedom||document.layers){0 w+ v4 v. m, Z, }) `2 R
with (document){8 R/ e1 l- E9 k+ y9 ?. W/ ~. @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 q  r/ g& R) g0 m
if (iedom){6 ~3 g2 L6 _. r% f& H9 F. }7 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ R$ ^( r( u3 s6 \# X% U3 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 w8 K8 e# }3 M7 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ |: ]1 J4 z# G
write('</div>')
( I7 F/ Q3 `! E" ]/ D}
( U4 c. i, [0 p$ g3 e& k3 a9 xelse if (document.layers){
, K- R0 w# H& R+ P4 I3 Z! r. `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( p+ }) b+ L0 I$ Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 g: w) J1 h' N, }1 X# y9 G" S( |
write('</ilayer>')
# G5 i3 Q' q) F- q1 l5 R: n( W' V: W}! H( m$ F8 _+ i+ \( f6 G
document.write('</td></table>')9 U' h1 ]% m+ |7 T9 u
}
8 M# L- c; I3 ~5 w) i}, S! \) v2 {. e3 g
</script>

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