返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ E6 e* r9 ~2 E, S# M5 h: {! |
var marqueewidth=300
8 U9 E. [8 @3 b, }" {* Z) u//高度3 Z: I. Y4 s3 C: C
var marqueeheight=255 S3 Q4 A/ ^/ z: M0 A
//速度(1-10)
# Y  ~; J# {9 U' q0 t' E+ rvar marqueespeed=3
5 n2 O0 L6 H3 k* k' ]* ^//背景颜色
) x0 F" \4 K2 a% n0 {var marqueebgcolor="#FFFFFF"
! z# D1 N" _8 ~3 j4 @; {( u: w//是否能暂停 (0=no. 1=yes)?
+ u' p/ f* a' c! D; ~var pauseit=1
8 A4 y  U7 S: `- n& `4 X& B3 O- }# B+ u5 J/ ]+ |2 i& ~  s8 A0 B* ?# O
//修改显示内容2 `6 ]: K# Z/ ?3 \' l' m/ U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 z8 i1 h' W1 q* u6 r% I
6 G: \& s- l+ c1 H
. X% |: B' X, g- Q+ ?2 {
////下面不需改变////////////7 @( V2 {  H% Z, u: X# g

$ Z5 o% f' A" `/ @' gvar copyspeed=marqueespeed" e9 \7 s5 g# p: b
var pausespeed=(pauseit==0)? copyspeed: 00 ]  e5 v5 w" ]% C9 V8 @* k
var iedom=document.all||document.getElementById
) D4 J1 [, G- S+ K& eif (iedom)0 @$ v! K1 e% |- X! @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- W- R% ]& l* r/ R1 ~& Ovar actualwidth=''
/ o3 z" q5 b( f6 x; j0 z6 I2 h0 mvar cross_marquee, ns_marquee
% f( T; ~) U; m/ Z* {9 @& i
1 D  D3 i  t3 A$ S2 _- gfunction populate(){
1 i: `4 V# z0 F) v# }if (iedom){4 u$ U7 w7 L( j. ?7 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; l, v4 z4 V+ ycross_marquee.style.left=marqueewidth+8) i3 |# M' [% K& U+ [6 i) V+ |  J9 S6 ~
cross_marquee.innerHTML=marqueecontent& Q9 [5 _: Z$ X3 m0 V3 W  V* D: `! d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 R- k* z3 ]! c}/ [( v# {$ G8 s# J
else if (document.layers){
" j0 T6 z# ]5 s2 @7 f! d$ Pns_marquee=document.ns_marquee.document.ns_marquee2
+ r) z* K, j5 D' D7 U& Ins_marquee.left=marqueewidth+8
  ~, @  O: ]0 |ns_marquee.document.write(marqueecontent)
: v, p' e% Y* D8 f, |ns_marquee.document.close()
7 a9 f1 l: j) ?$ w8 @; p: H7 L7 z7 F/ k4 kactualwidth=ns_marquee.document.width4 j3 O+ w, y7 Q! C
}) o2 f, \2 B- I
lefttime=setInterval("scrollmarquee()",20)
2 O! C+ B0 L( y" Q, x}, R( F# }8 Q( F
window.onload=populate8 x  y* F( M/ B+ m
# C! z& I* J. ?3 W$ V# b
function scrollmarquee(){) t5 I, L  [' @9 `% a* ^
if (iedom){% y( G  I" j. y, j. R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 x9 t8 [- M/ G# ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, a+ d( L  f$ B6 ?. k) ~
else
, O$ }/ ?2 X/ o) a7 T- d6 S3 K$ @) tcross_marquee.style.left=marqueewidth+8
& p% P4 Q/ E/ z" o5 L6 a4 ^* @
+ \) K. y0 \4 u& z: g: p' q}- @4 c; g, Z3 i
else if (document.layers){' ]- I' c  w! N; O4 J* U
if (ns_marquee.left>(actualwidth*(-1)+8)): ?; _8 p* G* Y. a
ns_marquee.left-=copyspeed1 D2 a! T. P  D: _5 w0 Q
else1 e' S. w+ }) j0 I( Q2 z
ns_marquee.left=marqueewidth+86 }; V! ~/ l' W. W. V2 W" a
}; w. D+ r3 b/ r2 @! C4 s
}( K7 T/ R9 x8 G4 E% k7 s2 }( ^$ `

# T- j' Q: \) K, `$ [- tif (iedom||document.layers){
. N. @8 p+ R3 v) z7 f  u6 y' Z/ q5 ?' cwith (document){
' q0 a1 |& w1 q& Y/ ]- \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 [: M8 s1 F4 {& I; l/ U6 A2 s7 ]if (iedom){" n" M  \+ W6 D: v7 K9 m0 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& i/ A/ {9 Y! h) }; _/ H4 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); S6 R6 [% w" C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" L% V* |" J. @0 N5 Ywrite('</div>')% @6 ~8 R) l. }9 n9 R1 c, a
}2 Z3 b3 t+ Y5 S% j0 K
else if (document.layers){
* E" j7 l& m& K  S3 gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): d; ~2 P  R7 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 {: J/ M2 x# h* |& |+ D
write('</ilayer>')2 m* x! n# y6 @* ]8 h/ Y  S: ]
}
3 W* J/ U/ J& y" q; h, E3 a( j8 f  d3 Q# j6 Qdocument.write('</td></table>')3 U% a) R* v, S! Z- L* i9 {, d
}
" ^3 p* g! X) V) ~! z}% c$ W% O# {/ w1 m1 G1 D  ]  F
</script>

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