返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ T# H+ Z' h$ x' P8 Y" m9 x! {var marqueewidth=300
8 J$ y) p, A! f3 n: l6 P//高度
  n) Y0 u  J3 A/ @; O, ivar marqueeheight=25$ S1 s% D) ]6 A* I# P
//速度(1-10)0 g8 p* p% P  t
var marqueespeed=3, K( f' V: Z5 ]- I' a5 T
//背景颜色, B# E% C: I- k1 s2 E% P+ A
var marqueebgcolor="#FFFFFF"0 q. r0 S" C! y& X$ t* m
//是否能暂停 (0=no. 1=yes)?1 F- l# @5 b5 m8 q0 G$ Y
var pauseit=15 C1 }( C7 H4 v; B
$ }+ C1 J3 [+ W7 `
//修改显示内容
0 s$ ~3 v; l; pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ~& K+ [+ J" n  I$ |; Q( I( a

8 C6 g% g$ t8 d' A& u. R
" g: d1 q8 W: S' ~+ [9 y. q6 e////下面不需改变////////////" g+ V( B1 r5 i) o

, I4 B' T/ X3 q) S: r5 \var copyspeed=marqueespeed
) `3 N/ Z9 Z. B* u! l6 Avar pausespeed=(pauseit==0)? copyspeed: 0( q1 U7 N  s, r3 ?4 Y! S- ^
var iedom=document.all||document.getElementById
) q* r& l* |7 ?7 B0 sif (iedom); m' k5 x3 W+ A% O8 ^0 \9 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 I9 u1 N" p; G2 J3 E/ e' m
var actualwidth=''3 F/ _4 ^2 p# z
var cross_marquee, ns_marquee
/ S7 _, U8 F# r; E5 b% h/ ~
; \6 f# p8 C- X6 \5 ]1 Bfunction populate(){# J& [1 [3 A: H/ ?
if (iedom){
, A! W* A& c! @) k- |! ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  r% U0 s, D  @4 [! zcross_marquee.style.left=marqueewidth+8
4 e' M2 h4 V' vcross_marquee.innerHTML=marqueecontent
- q9 k, ?+ a7 ~4 Y7 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- b  I* @7 k  N3 G+ o* s}# u9 T1 g1 D  `* C
else if (document.layers){
# l% p$ L8 b* O/ j# Rns_marquee=document.ns_marquee.document.ns_marquee28 \) c6 Z$ z( i8 n* v
ns_marquee.left=marqueewidth+8
- D" s. O) q. Yns_marquee.document.write(marqueecontent)2 a6 U! E1 S# v; V7 i' G
ns_marquee.document.close()7 q* O. w( e4 z- e
actualwidth=ns_marquee.document.width4 b2 m8 w: z3 r$ ]/ i
}0 E9 f! T9 l' n8 Z  ]
lefttime=setInterval("scrollmarquee()",20)+ n1 ]/ b, `2 I5 Z. D
}" y/ g( P4 R3 I- i. I( z6 h
window.onload=populate* Q/ g) {# U1 A0 ^, U0 y* ^3 f

0 [$ k( j0 y" p: U3 U! }) Nfunction scrollmarquee(){
' Z! ~4 Q- U8 C% ^2 q; Wif (iedom){
* M. [( N& |  v8 N$ P) q4 g- @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" q  _8 ^0 u+ ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 b) b4 y* d- L5 v+ o$ T
else/ C4 H2 m% p3 Z/ U
cross_marquee.style.left=marqueewidth+8
$ N, `( s: E7 u: e0 E: k5 [3 q8 V  P+ {
}
0 W7 Q2 z; Q, selse if (document.layers){
4 A1 @5 z2 Z( Cif (ns_marquee.left>(actualwidth*(-1)+8))4 {1 n+ b3 K& v' u' P
ns_marquee.left-=copyspeed: |+ a9 R7 @, j9 e8 R" A! O
else! L5 N: K6 u8 e9 P/ F9 h! x
ns_marquee.left=marqueewidth+8
& _9 [$ _4 x/ c$ F0 a" C4 q% {}) n6 P- \8 o& m. J% e6 c4 C
}. q: Q6 y: d% ]) H5 Q2 p9 y
6 s4 r9 @: x/ \; D
if (iedom||document.layers){6 ^& l! O1 a2 W- s/ K5 H3 E& q6 h
with (document){, \& H, L8 z# M; D+ U7 p9 ~$ E7 Y0 c) h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 b$ y2 B+ B8 N$ E; B$ F* U
if (iedom){
3 C6 t2 b7 @: H* N" xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 s- ~2 i. q+ u. T: @" r8 x% ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), M) h; x% R6 \( X" y0 \4 _2 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 `, n; ]4 x/ G0 M: h
write('</div>')7 e  I5 k, b  d& i, Z3 \
}
4 _4 f* l1 Q, Xelse if (document.layers){! s5 c. {3 J& j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 a. ]( O* f5 R9 q; }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 ^" X. n# d+ ]2 P: _
write('</ilayer>'); \* g# i, G6 ]' G
}
5 V( a4 d, V- V2 N2 G# E0 hdocument.write('</td></table>')
) g. g3 |! E4 G6 D$ N+ s' U}4 i; c+ \# c  b) Z$ Y. S
}
. ?, Z3 y4 j2 `( R</script>

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