获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# ]9 I7 ]( D" Wvar marqueewidth=300
: ~3 G) s$ D/ `; j0 ?2 v//高度6 @: T! A; @& T  i- j# g- s
var marqueeheight=25
3 Y/ |/ U: l+ M& \//速度(1-10)
# s; u; E. p2 a# ]/ Hvar marqueespeed=3% b4 `* m2 u1 x
//背景颜色2 p$ h, d1 @  C: {; h7 y
var marqueebgcolor="#FFFFFF"# H/ c6 G) L+ K3 }3 ^7 }
//是否能暂停 (0=no. 1=yes)?4 ~) g7 T  E* V# P
var pauseit=1) U7 p3 Z  `% S
4 S8 L/ W& \6 b+ Q& X- a; W
//修改显示内容
  M: a" ?; Q# @4 D- Y$ W  |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: [/ X( i  k% e- y. N: L8 V) f
6 v# C. ]2 C, R( m  |5 o1 @+ F0 p) B; V. m) |4 P; o
////下面不需改变////////////$ j: a4 t* X, S7 B1 s

* ^% c, k4 }7 a) uvar copyspeed=marqueespeed9 v7 R' L" i0 m5 J( p* R: h
var pausespeed=(pauseit==0)? copyspeed: 0/ E  z) @$ ]: m  p! o1 C
var iedom=document.all||document.getElementById
2 I% @% Z8 ^0 q# Q6 [* Qif (iedom)
- H& G- k/ ~  o, k1 s: Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 e/ N( r+ M( i4 Svar actualwidth=''5 U6 o+ X- {. r% |. j' W
var cross_marquee, ns_marquee; d- R! a6 d: g& y% x% |

/ D* s% W) Y, V! @function populate(){
0 x; G; F2 k/ Cif (iedom){: B# X" L3 h( ]4 h6 Q& S: B4 H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. }4 A# ]" x# s( ?" K
cross_marquee.style.left=marqueewidth+8$ p* {1 F* ^* J2 S+ H' v5 q
cross_marquee.innerHTML=marqueecontent- M, b3 G+ Q! B, k1 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 W" {6 z# ^% Z, S}0 @* P% \0 Z, H4 D2 M: a
else if (document.layers){
3 M5 b# O- n' a- cns_marquee=document.ns_marquee.document.ns_marquee2* R4 I! Y0 h2 N) Y3 s$ H9 y
ns_marquee.left=marqueewidth+8
' |4 j4 G3 _, @6 a1 Ons_marquee.document.write(marqueecontent). v) x, ?2 h4 ?3 [/ r0 g# N1 @
ns_marquee.document.close()
2 z3 n9 M; @# s7 g* r  `actualwidth=ns_marquee.document.width
8 j" R* |% h; ?- {# U$ n/ }, o" n}
' _( X3 v% P* [) {- k0 S) J1 Olefttime=setInterval("scrollmarquee()",20)$ |6 A1 g& ~5 O
}! A, Q) a( Y% ^% P& r
window.onload=populate0 W* e8 O9 C9 f$ t
) T# a1 ?, K8 b8 @4 p0 |
function scrollmarquee(){
( U. _4 w) P  s0 R7 o4 D1 zif (iedom){
/ N, ~: C( q0 D; F: y( b2 B5 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 V, Q6 E) ^( ?( h# j' I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 [& s# C  c0 o. ^: a
else
4 L8 `2 j' c4 J# N" }6 u% Ocross_marquee.style.left=marqueewidth+8
2 `7 C, v; {4 ?$ L/ x1 h0 `5 }$ y  }! O7 l5 }/ Y+ v; Y
}8 t$ s: @) u& O4 r
else if (document.layers){
+ v2 w. V2 ~: w8 {if (ns_marquee.left>(actualwidth*(-1)+8))
! I6 O! Y! r7 e! M/ hns_marquee.left-=copyspeed
, h. W; P. P! z  [# h0 g( r- ]else/ n, `  E& `! H6 O
ns_marquee.left=marqueewidth+8( y6 z9 ]) [1 m. ]- g; O
}
% W0 `2 M6 {$ T7 E% g. m}
3 G* j6 c/ [# g5 M; V4 w3 ~: N( q6 |
7 ?7 e3 Z3 ]3 `* w* kif (iedom||document.layers){! m" l7 \- m7 N- x4 d6 h/ I
with (document){
2 M# ^' ?* j7 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ `/ ?) E, _; ~
if (iedom){# c! S+ |" e# [7 U8 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 A; ^: {* O1 D# P! ^. u0 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ ^2 v& A- k0 ~* O# K6 v2 S. w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 c$ }/ s- |+ @8 m2 @& b3 G) y4 lwrite('</div>')8 T5 u9 u/ Z9 g( {  T/ b
}, \$ M2 y4 `4 n/ Z) t; M# d
else if (document.layers){. g  q5 M- O1 E1 F: A; j. {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 [# n- H0 T, k. X0 w6 d' F; Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% n- @/ F1 L9 a; h; i6 Nwrite('</ilayer>')4 O0 y/ e+ e. ~  b2 ^
}
; ^2 |2 d) ~. f" k: c+ m) J$ u5 x; g* ?1 Rdocument.write('</td></table>')0 ], [! h3 b$ g1 f. Q  R* v
}
1 \. \# |- i! D4 b+ r}
; H" C: j& \9 d8 y/ |5 \3 o</script>

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