返回列表 发帖

网页之跑马灯文字特效

//修改宽度  ?/ y& {5 j# ^
var marqueewidth=300% ^, n; B: g# X
//高度
9 ~& \( i- O& @% |  d9 }  o3 gvar marqueeheight=25
8 y, t- V* B' J2 |3 Z//速度(1-10)8 @! j* m+ J* p: C  B: G
var marqueespeed=3, [- N$ O5 n# p0 p) y- l
//背景颜色/ d) Y6 i' P% l+ |
var marqueebgcolor="#FFFFFF"
* `7 }' A0 |* l  A5 G9 {//是否能暂停 (0=no. 1=yes)?
$ z& y+ ^/ i# u1 q. I. R) avar pauseit=1
$ x+ y8 V3 V* b
, t0 @0 f9 r, I" A' p" z, Y6 _//修改显示内容, w) m& S- V! _/ T+ E* G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; ?5 W+ a# G6 S# F% c
0 c; }+ |  b3 }2 h' N* R9 p- V' J5 ~- @
////下面不需改变////////////
' n; J2 D1 b& C3 K4 z3 I- E" C, E8 ^
var copyspeed=marqueespeed# [7 Q3 e5 E* i
var pausespeed=(pauseit==0)? copyspeed: 0) g. `  t& u* E  ~% I+ k
var iedom=document.all||document.getElementById! V1 m; ~$ l5 R3 `1 i
if (iedom)
# l  a2 x+ \- K; n3 Z9 a0 I* |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 H% v3 c- G2 `; \8 y+ Q: U7 zvar actualwidth=''
! b# a! t9 i! j3 V3 c/ Yvar cross_marquee, ns_marquee
4 x8 t" L7 r3 J4 P$ o4 a
# K: f! }, w) S" Lfunction populate(){
3 M" |- [8 C/ ~" r* ?. ?: vif (iedom){
" \( N7 V6 @7 ~) bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' k+ [4 i! f  G+ a* Z5 Z
cross_marquee.style.left=marqueewidth+8" J! ^2 @& |* A6 K0 ~
cross_marquee.innerHTML=marqueecontent. Y8 @* M+ s- t( c! F3 E3 h6 ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. g$ V- _; _& z) T
}. W  y1 H2 J9 ]- k- a* V- ^
else if (document.layers){0 i! ?# c! `, \4 f
ns_marquee=document.ns_marquee.document.ns_marquee26 b& o; L$ ?/ l" j: B
ns_marquee.left=marqueewidth+8
0 Y0 d- S2 H. H) Fns_marquee.document.write(marqueecontent)
; i9 [+ Q! C/ F, f; W+ qns_marquee.document.close()
  C0 Y* R# G- b7 Z9 Z+ }actualwidth=ns_marquee.document.width
) m; j/ H6 E$ z+ g7 E& m# d}
! ~  L* o' o  u8 E& llefttime=setInterval("scrollmarquee()",20)
; Y+ T) F; K7 U2 X. w" ^}3 A' ]! E7 G7 i" l! A) y
window.onload=populate
1 C% y# a+ G) K4 U4 _9 o/ S2 J9 B( |0 a9 v4 [7 I3 ?( Z
function scrollmarquee(){
  e% W. x: P9 T; P/ ~# Z/ x" M* Iif (iedom){
7 N- {. I  P8 ?8 b1 T0 @8 }" s/ {# @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' u1 a2 y+ B  Y! ?1 z! F+ T' `: s+ S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 u. b) N0 Q7 O8 y' Ielse
+ A$ z  J: \* c# P. f% }$ }! lcross_marquee.style.left=marqueewidth+87 f1 a& A" f3 t

2 _6 K. Z6 `% e}
& b/ a8 c; \5 n3 H, p' Zelse if (document.layers){
0 f: }% K6 }( u* s4 Yif (ns_marquee.left>(actualwidth*(-1)+8))
1 H# O: E1 {, y, t( L& ]ns_marquee.left-=copyspeed! q( H- m4 A' Q" D7 w
else
: g% ~/ E' ]9 Z1 s' t- ens_marquee.left=marqueewidth+8" Z& ~5 g9 x! q9 r5 w
}2 C, z$ w7 k5 |3 p  f1 C0 B
}( ^3 N! n' u0 y- T, q

" \$ K. `9 I$ C- C0 z9 W# h. @if (iedom||document.layers){2 p& k) c( v" d% w
with (document){
' {4 _9 S/ s9 s) {# Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- m; M3 \0 m: r" M
if (iedom){% ]# G* g0 f+ Z& w9 Q% O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 z# F7 W2 r+ z6 h/ K% e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% G* ?& j3 M  w2 E; ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 m! q/ E. `) I- r' twrite('</div>')
8 Z% p% h4 A. ]6 i* b) f; E}
- m. w- V0 T) uelse if (document.layers){2 V0 _1 N# S% y' f  A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 Q6 }1 J9 o7 z& v$ u* O6 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ a! e5 @) }3 U- I7 E7 F# Dwrite('</ilayer>')
! [. r% l! S0 A# M" k- @5 R}
. Z0 ]+ A" W6 G& L/ Fdocument.write('</td></table>')
$ u% l5 C/ O, M( P5 _% O}4 g3 Y0 q5 i5 {
}( l1 @) j! ]  g& G' ?$ K9 o
</script>

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