返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% e" I! o) A5 ivar marqueewidth=300
  T7 g) X+ m" D//高度$ e) R7 Z1 P9 D/ O4 @
var marqueeheight=25- G+ J2 L4 B) r" a& I7 Z5 U
//速度(1-10)6 B4 ~8 \; M4 L5 k
var marqueespeed=30 [* j- T; g8 I; x- i  _
//背景颜色
& v7 h5 \/ u2 o8 g4 F1 T; g- Nvar marqueebgcolor="#FFFFFF"9 o* D0 T) n) B8 }, _  X1 O* i4 Q: Y
//是否能暂停 (0=no. 1=yes)?
4 D8 ~* u- g$ Nvar pauseit=19 Y8 H; D: v9 Q3 L- `9 Y2 i; P7 `0 q

+ ^1 [' j1 `6 d//修改显示内容: T9 X2 R& @3 J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& u8 Z! f  t8 H' g# W" t) p9 E

+ @  b: P$ y" P: ^" X1 z( C% y5 Q
, @! U4 y. ^; g. |2 Z////下面不需改变////////////8 s% D: X2 N# u9 w
, [, n+ K0 T8 }; f8 q
var copyspeed=marqueespeed
7 B% N& [  Y" N" \9 A( cvar pausespeed=(pauseit==0)? copyspeed: 0
. V2 b4 ]" n; k* Z* m8 s1 I& X( _var iedom=document.all||document.getElementById, ~9 w: Z2 C% l
if (iedom)" @# Y1 [) y% d+ i# Q% v# a  {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 J0 W) J+ V! Q9 f2 A0 [$ A( m
var actualwidth=''# l+ y' N7 h  I3 N/ a
var cross_marquee, ns_marquee
/ J- P: M% c% R$ R5 A+ w. b7 B- z4 F: A! [7 a* @: ^
function populate(){( ^* l& H  M7 }2 B
if (iedom){
4 W, E0 I' G1 R) R+ Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! x) l$ o/ c% ]9 c; S
cross_marquee.style.left=marqueewidth+8/ \, z! X5 l2 s; g
cross_marquee.innerHTML=marqueecontent
+ {0 S8 r6 _; u. P4 A, Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 S% B2 `1 Q$ M/ R( F6 O7 g}
. R; F( t: ]$ Y. {: i$ zelse if (document.layers){
( F% g. N' _9 ?+ d7 ?) A7 H1 pns_marquee=document.ns_marquee.document.ns_marquee2
! P2 M3 }; t7 d% `. Yns_marquee.left=marqueewidth+8
% E3 Z$ v( Y8 Z5 y3 g% }ns_marquee.document.write(marqueecontent)
9 L$ p- g% [$ I7 W8 ~ns_marquee.document.close()1 p# u  A: w; _9 R8 i7 b1 g$ D
actualwidth=ns_marquee.document.width8 d& g0 w* E$ o; E
}1 G3 _8 j& d1 V  z
lefttime=setInterval("scrollmarquee()",20)) K8 ?; z, K% Z& ?: r$ n
}
' A0 \$ z% b" `' Qwindow.onload=populate
) j  `1 ]5 Z/ q; W/ Y3 c
: U- @/ q: K, Q- {4 |* z' q& |5 Pfunction scrollmarquee(){
5 F1 `9 S& @+ A: O7 tif (iedom){
$ R+ R' m1 [1 yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 `# b& F, J: C0 u( f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 Z. f& ?1 F& G: \
else
0 s8 I+ \" r( k- x2 q0 ^cross_marquee.style.left=marqueewidth+8) B  I5 {- c2 c: B+ E6 T' Y; `# n& z
  W, u7 h8 f, F+ O7 t% a3 K- x
}
* |) G7 o, e+ l) r3 Z: Y6 Xelse if (document.layers){8 m) G" @0 M( W+ s
if (ns_marquee.left>(actualwidth*(-1)+8))4 y% V6 u7 |5 h% D( J- C; T
ns_marquee.left-=copyspeed
4 G: S! _# Z2 q! V- \+ Qelse, D7 K0 C/ |3 Y
ns_marquee.left=marqueewidth+8
2 h9 f5 F4 x6 P2 W7 R# w3 L}
) b3 y, o4 v  ?1 U0 ~0 L9 k}
+ U+ `4 z' n' x8 T  Y# x/ `1 s4 N1 B& k" E( ?
if (iedom||document.layers){
! U' B  Z. i& v" j% ?# @with (document){
: z9 P& a! g, g" e8 E5 U9 b' ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! q* i: P8 |% Z3 @if (iedom){
9 U/ B5 [5 P1 p, R% [4 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 D( q; ?7 y6 {* |; N+ d2 L: z9 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# J: T! }" I7 a( B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  z; b8 B* b& u" E: d/ |' L- C0 ewrite('</div>')
8 [- N1 e% R- \; y}
& c; |8 c  J  K$ ^/ ^# B, f% Oelse if (document.layers){6 l8 E3 e( s9 _7 Q5 M/ f; |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); e' b, U: |+ P& A( u5 U5 v6 C7 c( [, u
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ p) u' k& k* f$ mwrite('</ilayer>')
2 I! L! c' L  w}
4 w  [- F; f8 L% adocument.write('</td></table>')
* h9 ~" x6 b& W9 u6 P}
* I2 W3 w. K9 a" V: n- D% \}
$ y# }2 f6 l$ ~) f# G2 Y' g0 W+ Y</script>

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