返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 X, [5 o/ f- @& @4 d# j% B5 T
var marqueewidth=300# K8 F2 B( w0 q; b
//高度2 `- E% c" o9 ~- u  P7 o1 A9 v2 ^
var marqueeheight=25
1 n2 q4 j( A9 H9 @! `//速度(1-10)5 Z8 m7 u& k+ q3 M6 {, [
var marqueespeed=3
, J9 o; `9 d7 }0 \//背景颜色
" {5 w- r1 }: ?# F& ~8 v/ y) [var marqueebgcolor="#FFFFFF"
& F! D6 {; j1 g% {0 V* p7 T& W$ C! u//是否能暂停 (0=no. 1=yes)?0 d: K6 |- |: t# x# q2 ~
var pauseit=1
" |. b7 I5 x6 |
3 X% Q  s9 u$ C5 B( m" n//修改显示内容
  T8 V# _- t) f, z: p* N- ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 k: T4 U) R5 d& i3 o* Q" R( q9 n# m0 x# H+ C

% |) Y' Y2 G. T. _: j; {////下面不需改变////////////4 L& p  ]/ O+ J3 \* W- C3 A* D+ ^

  P9 V! G. |' A$ D6 A+ }# e7 @var copyspeed=marqueespeed
; R6 M: T$ J0 |, c' c9 {2 d6 b' uvar pausespeed=(pauseit==0)? copyspeed: 0% V) K2 W7 W% T, o8 o0 r
var iedom=document.all||document.getElementById
3 ^' q+ g. |+ h8 a' K1 D; Nif (iedom)
( f6 M$ J, {' rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Q: m/ h$ [' t9 q2 ]var actualwidth=''
7 ?: c1 H1 i' n' _var cross_marquee, ns_marquee
: d/ {! [0 A3 h* I% X- x1 g. y1 j/ c* a6 Z/ V2 S0 X8 Z- W
function populate(){1 [1 L6 T: e" |' `; B5 m6 }! w
if (iedom){
- ]+ k! m& I% Z0 \( M; |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 ]1 c7 }* Z+ Wcross_marquee.style.left=marqueewidth+8' T" ^+ z6 G% ~2 h4 u; `
cross_marquee.innerHTML=marqueecontent. |( H  w. v) t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# Y1 H3 t5 i+ ]( D2 K}0 f4 @# G9 ~5 [8 K$ P
else if (document.layers){
6 a0 e/ [. g+ rns_marquee=document.ns_marquee.document.ns_marquee2
; G( w- }; D! X  o/ d" }; kns_marquee.left=marqueewidth+8
$ K- V* p& l, l" [% t$ fns_marquee.document.write(marqueecontent)
/ a8 a; a& c  {2 ^/ \ns_marquee.document.close()
6 B  Z. j; d3 I7 B& Z8 J  q4 Oactualwidth=ns_marquee.document.width. G$ L! W* |3 o
}: q2 O+ G, m8 o4 @: j0 H
lefttime=setInterval("scrollmarquee()",20)( l; D4 ]9 H; A- q) m6 k, q/ k
}
0 f: E, u' Q- l8 {/ r  Zwindow.onload=populate+ K6 y  ]9 G% Z/ g/ l2 K' Q( p$ z( {

' Z# g- R" N; O6 u# v; Mfunction scrollmarquee(){
2 R" b: M/ l  N8 ~% vif (iedom){
& r+ X" m) H8 O# J2 k; n5 q: Y( wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 s9 d" p' a# F) L) _4 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 |; ]$ l, Z9 i7 i9 h! Delse
" P! H% c& u( R) T. |- a, ^$ Xcross_marquee.style.left=marqueewidth+8
3 R; z. C: Q  M8 y. Q. p) x* W% ]- q3 `: R2 w7 t- r
}0 R) y( g1 I1 ]' B, g; n' E
else if (document.layers){" t) |" L" k( l& @. L) a
if (ns_marquee.left>(actualwidth*(-1)+8))8 M; d, E8 i7 B7 S6 e8 g
ns_marquee.left-=copyspeed9 n( P" x' v& j  O" x3 L  B) E
else
7 z) J/ c7 v( m0 O, cns_marquee.left=marqueewidth+84 }2 P9 S# r4 g: }
}
# ^8 @- j# d& T( S: o0 z}, {9 G3 _2 x, J
( q; J. U& h6 Z2 ~4 U3 Q
if (iedom||document.layers){
; H5 x0 J) j5 T# Y  \6 W0 ~4 B* [/ Swith (document){
0 W5 H: ~) I$ T9 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); N; M, w+ e& s. \3 k) }
if (iedom){
9 x6 z# X+ x( f& ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 j4 |# Z; B, D; g' B* H. t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 D9 S- ^% a0 m0 g. X* ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 N: _3 R6 k7 N+ d
write('</div>')+ Q0 p4 `8 @% A2 s: {
}. M6 A2 {! F2 z  [& H; {
else if (document.layers){5 R, n0 d2 v0 j# l8 J- l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" i2 c( x9 K6 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) f& ~) J4 L& f) z  Q' ?, M
write('</ilayer>')2 b0 {8 Y4 L7 v6 D  b  c
}8 d' m1 a% U0 v3 V0 ?9 L3 T) q1 |
document.write('</td></table>')' w$ r4 z* `- h
}
( I( ?" c, U. D5 E}
4 ~3 z3 B+ T1 Z2 n( y: l: ^) J</script>

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