返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( L1 u4 U( O9 l1 Kvar marqueewidth=300& R9 P2 f  T* v# R
//高度
) J" K! Z5 b/ _, yvar marqueeheight=25
' R* F9 w" G( m+ F9 t//速度(1-10)3 \) ~2 X& y5 ^& }) |# z, W; A
var marqueespeed=3
% _9 G) R- P( b//背景颜色$ e9 C0 @5 O' G- K
var marqueebgcolor="#FFFFFF"/ ]! F' D8 ?! P1 y7 r, p3 a( r& O
//是否能暂停 (0=no. 1=yes)?, _0 x8 o  N0 ]3 n% X
var pauseit=1
: W# K6 m: P4 u- Q- ]) b9 B& c9 l$ P# n# D. O( w$ @% \
//修改显示内容9 E) ]8 n3 x% ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; f7 }0 W' X3 k) k2 G8 f! ^, |
% Y7 }9 }5 f9 R7 X0 k2 J& R* c8 a. u/ n9 }
////下面不需改变////////////
" o" L4 K4 Z7 v
" X$ B2 g  {6 e# Nvar copyspeed=marqueespeed
* U9 E2 G! Y- n- f, z; U: X8 {var pausespeed=(pauseit==0)? copyspeed: 0
7 O& Z5 M3 |% I$ Avar iedom=document.all||document.getElementById& z4 w: v1 y$ X# J/ G1 X3 Q
if (iedom)
: ~: x% `4 t% }5 C8 \( qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: _9 a9 T* H( A8 r) z3 L+ Y# ~: vvar actualwidth=''
2 P4 y; ^3 ?% Jvar cross_marquee, ns_marquee0 {$ e  V- T3 X' A% C/ f
4 M4 ^5 ~3 T4 l; ^- ?- V% ~
function populate(){
2 d' V( B5 _& P/ Q5 X5 Hif (iedom){$ @" c. I) ~, |: h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# y" U8 t% z2 |6 T# ]7 N# I) zcross_marquee.style.left=marqueewidth+8
+ E' ?5 d  H3 R1 v. B9 Icross_marquee.innerHTML=marqueecontent6 W' h5 T5 G7 L3 |' Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  s# T$ W# t' n}8 U; E- e) h5 ?* ~, c0 Y
else if (document.layers){
, o/ i9 v% @$ h9 E5 \. L3 }* t- f7 Yns_marquee=document.ns_marquee.document.ns_marquee2
0 X0 L$ l8 ]( ^: N% lns_marquee.left=marqueewidth+8
9 T! i, v# p7 a# V& c' o; ~8 Wns_marquee.document.write(marqueecontent)
" P4 N4 z; a" ]9 `7 {+ Pns_marquee.document.close()
$ j# g+ ^) F0 N# z4 ?  g: k. c7 Tactualwidth=ns_marquee.document.width
/ h2 Q/ r6 M; s+ s) I; Y+ M}( o0 I3 A5 M% U% ]! f6 F' K
lefttime=setInterval("scrollmarquee()",20)9 \2 v. B6 p2 B  a5 S: c  A& B2 ~
}
& ]' k4 d* [. Y) u+ v" X. mwindow.onload=populate& {" p! R, F5 L. v8 X2 t
, O. B0 R1 d! y  N* O1 O0 X
function scrollmarquee(){4 |& S6 z  X' s8 ?2 z/ d
if (iedom){( U& u7 a  d! x  ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& {4 f) T4 @; h1 mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 v' n$ \& o- T0 Oelse
& [4 o: D- U7 m; pcross_marquee.style.left=marqueewidth+8' ?! P9 p: R+ M% J, X
5 x( z& j, N% f  f
}
; i' v! Z# a' U6 A& ]2 Aelse if (document.layers){) V8 f6 g+ B0 u# e
if (ns_marquee.left>(actualwidth*(-1)+8))  x* {2 J# q1 \! F* s
ns_marquee.left-=copyspeed
1 l& ?+ S; H& zelse
1 q) v1 s/ F1 A+ N  v6 ^# r1 gns_marquee.left=marqueewidth+8
, |0 C* |; G& Z# M( g}1 A% M( `1 a5 ~' g* z- ]
}& a8 S8 P/ L1 n  t# e' n2 u- A/ T$ D
- h) M( e0 d9 [( n; x1 t8 E; Q6 W
if (iedom||document.layers){
! W( v. w% f% r' D% _" A6 \with (document){
  {! R5 |4 H( m( _8 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" [- [0 |: q0 r8 v7 ^8 Q" \
if (iedom){
* D$ T7 X. s' Q. e; ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& [. G; _: U- Z/ l1 E8 hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! m6 u: G' s5 J: fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 l$ v# h/ f# }6 d' e
write('</div>')6 S3 r9 M! N3 t" W# [) A
}4 q- _4 F* @% A9 g
else if (document.layers){
% i# K! y+ m7 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 J2 I6 k" E  y  J4 X6 ]( H) Y6 ], g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 d# A  d0 B/ h# e. Y/ [write('</ilayer>')/ j- ]5 [" b* M3 |$ ]& D, n8 {
}
% M* F( c% A: q. l. i5 O8 Gdocument.write('</td></table>')
9 d$ q4 T1 U6 y8 z, M" V; C8 T. B}
' H" q- Q1 R" J}/ o4 T1 a- g  ]2 G7 K4 f4 F
</script>

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