|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度( o2 n1 p( u6 p
var marqueewidth=300$ I' b: K7 I: n% k
//高度
% d+ X; W/ j! N9 G3 _4 Dvar marqueeheight=25
1 l5 L0 ?, O) D' w6 t% N" W* ~3 {//速度(1-10)
: T) B2 H2 d- [( {, H) N! U6 k6 f U/ xvar marqueespeed=36 k( }1 | B+ q3 S6 [
//背景颜色
& v1 {1 |$ g+ q9 y b0 B+ Lvar marqueebgcolor="#FFFFFF"
6 J1 Y. d& l/ w" u& m% w0 s9 D//是否能暂停 (0=no. 1=yes)?
; F, o8 d5 N! V4 s! ?var pauseit=1
( A% B5 u) ]5 M1 K7 _; K0 m
# A8 t& T4 K) g q; W2 V//修改显示内容) b1 x+ w' s& B. Q7 e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! H* }/ C$ s% q1 r# A# P, {( }4 t
) @* |/ k5 N! a) g/ B
1 Z9 ~) @$ _; d# a. _7 _5 L5 D2 I/ x////下面不需改变////////////" t' p0 M% F. y6 s$ t7 a* h, j4 ~/ d W
* y+ F4 N' i$ h& }0 W3 @
var copyspeed=marqueespeed* ]- V# ?6 J4 ]) }/ {
var pausespeed=(pauseit==0)? copyspeed: 0
9 x/ x6 ]7 I( k. s! avar iedom=document.all||document.getElementById
5 X6 O: |3 i$ y. T0 y" Y2 `if (iedom); `, O+ L7 x/ J9 y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% |4 F9 F1 o) lvar actualwidth=''+ t$ O" C. C7 n
var cross_marquee, ns_marquee
( }$ c: E! M0 t8 l5 Q& I/ x/ ^( W7 D( @& o# \8 Y2 b
function populate(){! u9 n6 b$ l/ N1 A
if (iedom){3 _; i7 s9 X7 _- g ^# h, T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 d+ \6 H) |+ g2 W8 F9 ycross_marquee.style.left=marqueewidth+8/ P- E$ k; b6 j9 ~0 z1 b( ~
cross_marquee.innerHTML=marqueecontent
0 |* [$ ?: N' i1 D wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" X2 n `0 T+ Q6 o+ [1 _
}! Z* q2 z# V; j- t
else if (document.layers){4 F; }! ]. z0 j! X
ns_marquee=document.ns_marquee.document.ns_marquee20 L* s _: F1 x/ ?+ J3 w7 B2 s
ns_marquee.left=marqueewidth+8
5 w. |1 c0 S* t" Fns_marquee.document.write(marqueecontent)* r) S+ o' Y- R: m' e) d
ns_marquee.document.close()# `7 w+ J7 B# `, b' P
actualwidth=ns_marquee.document.width
' i) D+ D$ F* n' u# X}
* c' f1 k& m8 Ilefttime=setInterval("scrollmarquee()",20)7 E, Y x# R4 c1 M
}2 G& J4 E) K& ?8 y$ T' Y, |
window.onload=populate
: Q1 _6 G c; J0 A
" M+ K: @( f' m* [5 bfunction scrollmarquee(){
3 F+ |2 ^$ z' G, Qif (iedom){9 _8 I- @& C5 X1 x$ p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* m# i l3 ~& ~; S) e% Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( _5 E" {1 q3 }+ K8 U8 j" z: p
else) Q" ?* R$ I8 ~; M6 E. p; A
cross_marquee.style.left=marqueewidth+8
8 z; @- G' U$ f& \9 y! f
$ N, \# U! x% @8 r) U/ m" e}6 }9 G9 L T8 }" I6 q1 l/ ^3 b$ } T1 [
else if (document.layers){
% R6 b) f4 ~8 tif (ns_marquee.left>(actualwidth*(-1)+8))6 H! e3 K- w- u$ w. _$ f% h
ns_marquee.left-=copyspeed! Y- j( j I, P. q' V9 Y& Y
else
" t( E9 e/ [' J$ r1 ins_marquee.left=marqueewidth+8
, A! ~# `5 U& J1 V" ?}7 d0 Y: N7 {; b) F
}+ b( G+ |2 S) V1 a
# }5 _" E: P7 O j0 l& S
if (iedom||document.layers){$ |" |# Y7 ?! ?) B' n) q
with (document){: a/ r* ^" y, l4 P" \, l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 w( H8 o0 ] b2 N; F- [' `& o
if (iedom){* T$ N, r! t0 X& x) U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: `' J& O0 d. v J$ h8 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ n( O* V- h8 G, V3 A& D( ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- T% j+ f( |/ K
write('</div>')
- t# C- `, |4 _, o4 C1 ~; K# v0 b}
! E2 E1 @0 H# o& K7 u2 T2 W6 g- Uelse if (document.layers){" R! h! J; S$ k# ~6 G, }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( K: u. ]1 Z; U) }$ Z. T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- ^2 k& w# i4 m; O: E9 F8 `
write('</ilayer>')
3 \+ x1 [' m/ J4 L}; B. U2 v. Y0 Z3 F w
document.write('</td></table>')! m; o5 q, R6 |+ U! n
}
! H! H, x. I: I9 T+ ?- z. m( x}
/ k4 P, d$ n* y% F' W</script> |
|