返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 D7 n, N9 o2 d' i
var marqueewidth=300- @2 ?! o+ N8 r& ?
//高度3 w6 q3 K% ?3 `, a+ @% b7 |# _  L9 o
var marqueeheight=25
# Y8 o. _; ^. i, T, ^//速度(1-10)
  @0 E& W6 x7 w6 {- wvar marqueespeed=3! w! s9 k* p$ w; ^3 f! u# z! m" m
//背景颜色! z+ g( Z0 a  ~& A% A, s  y9 B& ?
var marqueebgcolor="#FFFFFF"
1 F3 N2 Y+ L' E1 r; N//是否能暂停 (0=no. 1=yes)?! i) ~6 u7 N! r, z
var pauseit=18 C% Z  D' n- @1 _5 f: J# C
. I0 d6 v3 {8 D+ d. |0 H( z) ~5 z
//修改显示内容
/ \. F2 v5 D3 l% S: Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: e% {; u5 V8 U1 ~- K9 O3 m5 K* H% S7 i1 D3 ~( J: N
+ d: d& h6 U, Q' U
////下面不需改变////////////
  |( M& j% o9 D  J+ m
( m! D  N. n* B0 O. V' b" L9 rvar copyspeed=marqueespeed% W/ x- M* ]* ]5 [0 I# n6 p4 t0 T. u9 P
var pausespeed=(pauseit==0)? copyspeed: 0; J3 ^5 R4 C2 V! P  w, Z+ j- g+ R
var iedom=document.all||document.getElementById
4 B& T, E4 \. G- D0 K, }if (iedom)
- s; V! k6 \) \: Y8 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 O. j; e( K4 T. P4 k' ^var actualwidth=''
! o# F3 {5 v2 n1 \, P: Jvar cross_marquee, ns_marquee
6 G4 x  j4 t5 Q5 E. g4 V' i: I  W) H( d8 N& ?
function populate(){
6 R. h% R& d9 A. Q2 n6 Y" u8 Rif (iedom){
% z& h# ]- k# y5 {" lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) ?$ k, \1 r. n: W- I# c3 {  L, gcross_marquee.style.left=marqueewidth+82 C7 D2 c( g" [# L9 I! v1 v
cross_marquee.innerHTML=marqueecontent) @& }+ Q3 O6 \. Y  ]9 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 C% t( L- {3 g  G9 d}
- ?  q1 m% a  pelse if (document.layers){7 U  S; G5 L4 h  j
ns_marquee=document.ns_marquee.document.ns_marquee2
: o+ d3 p& y5 e. |ns_marquee.left=marqueewidth+8
- M  O  y0 V, l; w4 q0 O4 M3 rns_marquee.document.write(marqueecontent)9 K- {! p' B$ r/ R( [% E. U- S
ns_marquee.document.close()4 ]' N- {7 n! U, b1 `6 s% i$ G
actualwidth=ns_marquee.document.width3 U! a" H4 w9 _  N/ c, D* y
}
% E" c, R, ]8 d8 Z7 i: ]lefttime=setInterval("scrollmarquee()",20): x! [2 j5 k) e# f
}) X- F/ _& x+ H4 w# G6 A
window.onload=populate
% ^2 \0 @" `) Z( I: W1 p- L) f5 H5 h
function scrollmarquee(){
9 e, d4 X1 `1 Wif (iedom){( ]5 t& k4 m5 g& B* ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 r3 R, T! x) U3 p2 a9 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! ], M4 }7 N. |; M1 W3 p
else
9 `$ t/ @" x6 N& }cross_marquee.style.left=marqueewidth+8
5 `  l9 M! E, A0 q1 W. Z8 b. M# c
( n" d, s& V( A( ^# n}
$ f* I7 A6 U% q! H( z4 B; }7 Qelse if (document.layers){
0 F8 p3 I8 m' }if (ns_marquee.left>(actualwidth*(-1)+8)); E; T( Z- m# D7 \( X' m
ns_marquee.left-=copyspeed
# u/ \* ]8 @0 \; Y# Nelse
" o) `  \# z$ qns_marquee.left=marqueewidth+8
: L' U0 P& `5 f5 S$ Z6 c}
3 g3 t8 o7 |% O" D}
, Q; x# O, L# n" Y: ?3 M' |8 d$ d2 u+ }1 l1 v% M" ~" E& W
if (iedom||document.layers){
' G7 t: q# U9 R$ Awith (document){8 G5 N$ X9 M/ l( i* i" G% Z" [) a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ l5 M" x/ _3 \$ g6 p* [if (iedom){
0 m7 ?; l* k# ]1 y! n/ Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 R1 ^; X* H8 J/ [7 d1 B( Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 t) t. }( p' c1 v0 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: J* }% y+ A& o3 V' P; cwrite('</div>')
0 e6 v( ?, O; }! L}
3 b' t3 h7 \  ~9 r& ielse if (document.layers){9 w3 o9 |9 X& r/ k3 L# Q: S/ j4 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 M( t% y8 l$ ^+ O& l; _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); ^5 {! ~9 s6 |, H7 S" V
write('</ilayer>')
$ K) Z4 |" D' N* @, d: Y}
$ b( v# R% j2 x- ?" H7 C3 T- Vdocument.write('</td></table>')9 |" M( @& p1 E; {
}# f3 v) l. e$ ^% H6 o  |
}
7 a' Z  X5 Z/ F- {3 f) }% E</script>

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