获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度  V& f, z3 U. u0 z' _& j( n" E: {
var marqueewidth=300& i, j* r/ @2 J& z" m9 b
//高度
' e( {4 e9 B5 O- O+ h* Nvar marqueeheight=25/ N$ w6 C8 u2 Z1 }4 S
//速度(1-10)4 h9 j& Q+ P* _: R
var marqueespeed=3
9 C" T4 S+ f* r; k; ?& p//背景颜色# ]8 G% g! L* x% Q: ~
var marqueebgcolor="#FFFFFF"0 ~* Z! k7 w/ F; I+ K+ r
//是否能暂停 (0=no. 1=yes)?! S# c- R, I5 H( j& l' Q" z3 j  N
var pauseit=17 W: I9 Q; [1 O! ]( y9 i* L4 F0 |  z

  A5 z4 d! c" |) n1 `3 @% L& U4 [//修改显示内容% t7 a6 y. h; Q0 H" k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 S& y# B) H7 \8 n
* W5 ]* S, E& y5 d
9 T: f% _7 a0 o9 l# T- p5 R) V////下面不需改变////////////
7 r1 `) s$ s$ z/ k  C1 ]* {# k9 ]
) A; q+ q7 |! g+ v3 k" z+ Q2 p/ ?var copyspeed=marqueespeed+ s6 W0 n3 {0 s( `& H
var pausespeed=(pauseit==0)? copyspeed: 0: |# ^8 E# R9 Q2 h
var iedom=document.all||document.getElementById
6 t9 S$ D' v) \$ Z& ]7 G( ]) Sif (iedom)
  P4 E) R. P4 x: N' P5 U# Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 a) k+ P7 w- R5 I1 T  j/ yvar actualwidth=''
- Z" ]8 X8 O& t5 p. W; Cvar cross_marquee, ns_marquee
" V9 h; S. I8 e& X2 [! z1 K0 z# P! j; ^9 a! W& P* |
function populate(){/ c9 p' O8 `+ B0 K, Q* C1 C2 o
if (iedom){
5 A  O7 |8 \" Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. p. Y# z; {8 v2 @, }2 X9 W: |
cross_marquee.style.left=marqueewidth+87 A8 L/ l5 @; B; u2 F$ C5 L
cross_marquee.innerHTML=marqueecontent3 M0 y, H! ~1 ^, F2 O, i2 V4 r7 u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ _1 \$ d9 {) Z}
3 Y! J3 r9 P* I& Gelse if (document.layers){
4 [: E+ b2 p) X- @1 w5 o4 l" P1 hns_marquee=document.ns_marquee.document.ns_marquee2/ u- I# g% J2 J) S( }, i
ns_marquee.left=marqueewidth+8& P8 i9 ^5 W* u2 p2 |* }2 y2 v3 J
ns_marquee.document.write(marqueecontent)# G8 c4 r$ e7 M* E7 u- N# Y* I
ns_marquee.document.close()1 D8 u; L$ h% }# m8 ?- ]
actualwidth=ns_marquee.document.width: U% Q+ ]( W( |( L# b+ d
}2 U, Y# }* m- w  _( l( }$ Q4 r7 y
lefttime=setInterval("scrollmarquee()",20)) x0 ^$ S/ o3 y2 _
}
0 ~5 W+ A( J) |$ P9 e5 B6 U/ Twindow.onload=populate1 E4 D# [8 J3 s
5 L9 {6 s' I+ y/ y; O6 c1 d
function scrollmarquee(){
& `8 @& h! V) `& A! T1 q. B& I& gif (iedom){
* E! r" _9 W3 ~( r  Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* ?7 y, f8 n) S( L# I  H  Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ a' ~; b1 s7 A: M1 {" J
else
) k9 i' N0 f  Ycross_marquee.style.left=marqueewidth+8& X+ S. \0 p8 W4 X6 q. l8 `2 U# B

9 r- w: o) a8 X+ X4 s" J- B}, k0 p! `8 }! U( D# Y
else if (document.layers){5 v! t* @( B) P/ v/ ~
if (ns_marquee.left>(actualwidth*(-1)+8))
. w+ F, S1 v9 |1 dns_marquee.left-=copyspeed
+ S; H- h! z5 ^2 O& k# f2 Z9 e# nelse
1 C- f6 L# C9 F4 K3 \0 d$ ins_marquee.left=marqueewidth+8
/ n/ V  f7 @9 P}
6 o7 h% F7 E' n8 J$ c}. z& g6 ~$ x/ T! |

5 Z3 h; X! z7 Y1 g- R' Sif (iedom||document.layers){
9 d& o& N6 o2 P4 F% ~9 ewith (document){
' ?9 f4 ~- |* e, K# Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: _: m) Y9 l. k3 {4 u9 g: hif (iedom){- Z& p: }+ t1 u& l! L/ ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 q" F( x4 \- L" ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' ]( A( g. Z! @- m! n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ k3 `% z8 s% A) |! w# qwrite('</div>')
# t6 q# f, X( b$ s- f7 V}
* f* @5 ~. d: R5 L+ F6 G5 |) J. ?else if (document.layers){
4 w: ^9 ]; `- u' \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ T' a- s& |2 B8 @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' A- G0 a: R6 ]$ g/ M+ lwrite('</ilayer>')% K3 ^5 Q% D2 ]% W" }3 ~
}# o& j5 ^4 d/ p6 x# }& S% X
document.write('</td></table>'): {6 }( U! h! U0 t( f  c! |& j# y
}) I" ?. `- m8 W% `4 A
}6 y/ y5 t4 j0 m
</script>

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