返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ ^4 k+ U8 F' _* ?var marqueewidth=300
, T  G7 M/ t8 @& K1 y$ y& j2 i//高度
" M; q, t7 k( Zvar marqueeheight=25" r+ J7 {& C5 g9 s% E
//速度(1-10)
/ u" A+ U) w' i: W" K7 Dvar marqueespeed=3; V* ?" l4 o, Y! Y
//背景颜色
1 p, ~; E, }) Wvar marqueebgcolor="#FFFFFF"7 I5 Z- |3 s8 D6 y
//是否能暂停 (0=no. 1=yes)?* ]' k$ N5 }+ ]6 Z/ ~) b
var pauseit=15 R: q2 i& y2 t% l( x) J

+ c. e' f2 O6 P9 E; c6 G//修改显示内容
$ _, Y0 ]! D" A2 V% v: cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. H7 h" {4 h. ~; t
5 }. F' Z, ^, ?: G7 ]
' S5 h- U3 `' c; f& B; q////下面不需改变////////////
; e; c. n/ ]6 `( }% f1 W# z. v) S+ G; g
var copyspeed=marqueespeed* k6 Q- o; ]) v3 o  x5 I
var pausespeed=(pauseit==0)? copyspeed: 0
: y7 ^$ r. F) W- m3 r. S4 kvar iedom=document.all||document.getElementById9 b" Z& n' v2 {' H% e* _" t
if (iedom)
6 N/ Y. J; ]# ?0 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 J, `$ z) F4 e2 b4 @
var actualwidth=''0 S9 y; }# U/ n, M
var cross_marquee, ns_marquee3 m7 ~( ?4 E# P0 }) o
7 V# {: s- _; Z8 b& X
function populate(){2 M0 j6 e% D/ M; m5 a9 G
if (iedom){: L7 v9 y: Y( p/ T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 ]6 d& m3 }3 x* across_marquee.style.left=marqueewidth+8
8 a+ ?4 l' T8 u# Mcross_marquee.innerHTML=marqueecontent
* W2 s  ]+ b/ t. p5 C, ^9 z- I' eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  a* o4 x# H  A! o  E! F" n1 \2 @
}
4 U- S; M) U! s- felse if (document.layers){
6 M/ L8 d; M, d  m5 J; Ins_marquee=document.ns_marquee.document.ns_marquee2
* g- B5 M: F' r6 W$ Hns_marquee.left=marqueewidth+88 S& g- ], ]* M6 |" s" X. z
ns_marquee.document.write(marqueecontent). @- _, s) P+ C9 A/ Z
ns_marquee.document.close()/ ~2 Y1 S  w% ]  ~7 b8 E; B
actualwidth=ns_marquee.document.width/ _# z& K( l) w# s* U+ Y- F
}
! M4 a9 `# F/ x; t9 Hlefttime=setInterval("scrollmarquee()",20)8 ]  ?3 G% A3 X8 r6 Q- l
}" ^1 U9 o6 b3 _, Y
window.onload=populate
- b3 M% C) F& J" e8 F% d" w8 `
% t9 ]& y" c  n/ zfunction scrollmarquee(){
5 q3 I; _# T9 L4 i* Iif (iedom){
/ k8 B4 u: N2 ?# ?/ v) s: p' |+ p7 M7 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. n2 m  A0 i$ S' k& {& K( Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, K! j! t5 f5 W, uelse3 m( B' K( ]. g) {
cross_marquee.style.left=marqueewidth+8
1 k4 f9 B7 [0 G) q- j6 n# m! f/ Y: R0 o" w; j* d" u
}
! t) G+ O9 S& R* Z# zelse if (document.layers){( p8 t, b4 f- B5 ^" H1 r1 E
if (ns_marquee.left>(actualwidth*(-1)+8))
% g7 r* T- a0 Z* O: ?( P8 yns_marquee.left-=copyspeed6 d, P6 m5 m6 R8 h2 J
else
9 ~( k. }0 I. t/ ins_marquee.left=marqueewidth+8
7 M  c5 u8 g% }  z# G$ o/ q}, Z& _9 t) Q$ j; n
}
! a9 {0 D* n& {4 V8 |( j4 ~0 v' A; [8 N; }1 v9 S1 |$ T  N
if (iedom||document.layers){3 D, w' L# x3 l* K& a/ R8 _5 _
with (document){% z; k, g2 T) f* i8 `7 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 s( ^4 Q( N2 B" O
if (iedom){
3 t9 }$ ^  `# Q2 ^* m: Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 C, {  I0 B' }9 Y' i3 iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- N* {$ L* l+ J) i/ h) \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- K  A: D9 B8 E( a# L2 f9 d4 ewrite('</div>')6 a  i% d: F7 h$ @' y& \( O( U* l
}
. ^, G3 m% I; u$ j) y0 Jelse if (document.layers){
+ d% p* y" v0 G- }% V4 Y7 P& q. Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 E% g3 A+ g' N, B5 A. H* Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' H2 x5 r0 P% Y8 ~$ @: |4 w6 X4 P! [
write('</ilayer>')* K0 [- b& a* |. x# `; g) S5 R
}8 d2 H6 X% T, {
document.write('</td></table>')3 e/ l/ z/ P& b( P1 g/ [. S
}( v/ d0 |4 J* X3 b1 t( ^
}! @5 Q, Z2 D5 m0 ?2 ?# t
</script>

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