返回列表 发帖

网页之跑马灯文字特效

//修改宽度- j9 e% b+ b. F: q# @# S! [
var marqueewidth=300
/ d$ _! H' M2 ]+ ]. R' y0 ~& A//高度. P, y7 H' Y% ?
var marqueeheight=25. _7 Y0 }7 C. a7 z0 J5 i
//速度(1-10)
* |7 N0 }3 [: F) g3 svar marqueespeed=3
7 U& J- g& h# v" v& E7 E//背景颜色! i* H# E1 v& G4 o# c" c) J6 D
var marqueebgcolor="#FFFFFF"- Z5 \( O3 U2 {/ W3 L: r6 [
//是否能暂停 (0=no. 1=yes)?
& V- C% \( Z5 |5 o. v8 Xvar pauseit=1
" |& H4 [, r+ j" P7 ~* r5 _' \
. `3 {& R4 |7 h" N9 Q//修改显示内容# B, Y- N; C. \2 Y1 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 q1 \8 w: D9 \# v6 W
2 c) a: e7 u+ h) ?

! E) u+ x% {# M////下面不需改变////////////
" E  o, L3 W: s' w- f) k/ s
+ e+ V: {/ k- H# K- Xvar copyspeed=marqueespeed
) d$ V6 n  i8 `. o- Hvar pausespeed=(pauseit==0)? copyspeed: 09 r1 S" k1 T7 O+ o! |
var iedom=document.all||document.getElementById- e# E8 s$ }: W0 ?. m0 w) C
if (iedom)1 e3 [  P3 N8 a6 b! H* {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& a; o3 z* e$ X2 q. ovar actualwidth=''2 \/ V8 [1 S. i, _8 p; h
var cross_marquee, ns_marquee
% G) d- X3 Q( o. X" ?1 t+ x- E& U' H5 F1 F# ?. e( M& N
function populate(){/ v3 ^8 a1 b+ v4 E2 g: m" X. F: c% j
if (iedom){
9 ^2 {7 v6 I9 Q( z& Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 l9 }5 G, N! t2 z7 P8 J0 xcross_marquee.style.left=marqueewidth+86 r! D, }4 r( V0 ~8 y9 Z- ]
cross_marquee.innerHTML=marqueecontent6 W8 J. S" t  ~) m' P5 w+ {) X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# B7 R+ w7 _7 n8 m' D8 P}) C1 G3 I0 I; |
else if (document.layers){
( Y1 |* C) R% m0 Hns_marquee=document.ns_marquee.document.ns_marquee2
) p6 x8 L7 a. L4 ]. t( \8 s) vns_marquee.left=marqueewidth+8
! J7 v( f, v, Q. E! u9 K; }; sns_marquee.document.write(marqueecontent)
6 b$ }! q0 _8 _8 c8 y  Tns_marquee.document.close()
6 H/ w( \, W0 }' a7 yactualwidth=ns_marquee.document.width
8 ]" O, ^0 b; d$ J0 l- W}
8 t: }' J# W; W% Ilefttime=setInterval("scrollmarquee()",20)
0 m5 W1 [5 l3 Q$ ^" m+ m, e}2 |( g  U. j, E. c; h
window.onload=populate0 Y8 h6 L  }# x1 `3 Q" Q5 C
  \: X) C2 ?# E" G; m+ }
function scrollmarquee(){
% L5 N& x; z2 W5 T0 X8 v5 \* [( u4 kif (iedom){) ^& [) B" g& ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 u& y/ O9 k& I5 w! e! y3 |# S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 ^/ x/ f. ]! l2 w, L2 Yelse/ s/ C2 z8 {4 ?
cross_marquee.style.left=marqueewidth+8
/ m, X/ N& y( F+ c/ w5 {6 h+ ], y  u7 R
}. D& L# d5 X3 _/ k0 D& e( g) y- q
else if (document.layers){1 f$ A( O+ r! d
if (ns_marquee.left>(actualwidth*(-1)+8))* C1 t( H. ~; T2 r
ns_marquee.left-=copyspeed
! `1 b( @7 @( k5 d5 u& qelse2 _- r: U- J% _- j0 M
ns_marquee.left=marqueewidth+8' U- |( a5 c) n1 s( m+ `
}) Q) r, _* i) O1 q3 G$ M
}
  T' c( g$ U7 c$ x6 m4 o: p; o
4 d% ^( k+ z$ s' z5 x  ^4 n+ Wif (iedom||document.layers){) ^; R  _; g) I) o/ E  v
with (document){
$ y& l' }1 I4 O! @5 m4 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 k$ b: v7 d( G  dif (iedom){6 L0 j9 _  S# `' U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( q5 R/ R) T, q7 W9 A- t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! R# L# i+ c: B* `# D$ Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" n2 ~* [( z& \/ k+ |* r; l: {; o% g
write('</div>')
; R+ @; g) i% E" `3 f, `) {}
4 V  ^6 G* p9 D: ~4 ?- Uelse if (document.layers){  n9 q4 C5 D: }" r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& H8 F+ v$ W6 k/ m9 v- J8 B& r: Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); J: B- A9 z% `( g" n) d
write('</ilayer>')9 c2 l; m0 i  t+ z
}+ ~8 O( S2 R5 ^: q6 I0 B
document.write('</td></table>')3 a  x$ z# r" ^8 e
}
1 w) y5 U- @1 j4 H' U% Z  J}
0 p" ]5 c+ K) P; g</script>

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