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

网页之跑马灯文字特效

//修改宽度% X3 H  t3 v" Z4 V! g: B; r
var marqueewidth=300
, I5 R) L3 S$ x- K6 `% C/ S( T' B//高度
, i+ s- d' B* ^+ }9 |8 a0 svar marqueeheight=256 k9 }2 a9 K# x3 S  {: g1 i$ m) {
//速度(1-10)
: A4 m( X9 k; [var marqueespeed=3
& }7 _% K9 r9 @4 Y- @( T//背景颜色
6 `; }8 q* j& x7 L# }$ mvar marqueebgcolor="#FFFFFF"
# H- r* p/ P8 X- J* ^0 j2 c//是否能暂停 (0=no. 1=yes)?
% |, v9 k: S" {8 ~  q" d- tvar pauseit=1
) a. n$ @( m1 @$ D/ `
# F- U4 B% T3 G$ X7 Y, r. p//修改显示内容+ G) I( l$ h' o# D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 B  J; I; }" B; w% j7 |/ e( F$ j
8 O6 C( |6 x* G9 k# K1 v8 Q  l
* h, Q6 u" \. u+ N////下面不需改变////////////
* l1 v+ Z$ e: @( u/ I# Y6 }  I' V  u2 \
var copyspeed=marqueespeed
( s" [/ I; r! x) Tvar pausespeed=(pauseit==0)? copyspeed: 0
0 a% ^& _, \1 S4 [var iedom=document.all||document.getElementById
4 ?* ?1 ]; O0 `" h/ nif (iedom)+ K; m/ ~: P  H0 q: k/ f, {4 G; ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 ?# {' e% n4 A& d4 x( ?var actualwidth=''
9 q8 A* i( B4 N/ W& T$ _; Avar cross_marquee, ns_marquee
+ K( ]. x# M7 g
# l0 c0 B$ a7 r- e/ {function populate(){
9 W1 g1 H4 X& F, w0 V4 Zif (iedom){
/ t4 d4 a' [; ?( Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ }# R( f$ f$ K# q' G1 vcross_marquee.style.left=marqueewidth+8
% M' y# I/ Q) Gcross_marquee.innerHTML=marqueecontent
# j% F# w& T; d. P2 e$ ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 R" |) w; o) \0 U
}- v8 `9 X* h2 z: _6 {. y
else if (document.layers){
8 u2 C; h. g* N- n$ c) kns_marquee=document.ns_marquee.document.ns_marquee2$ p" [% N/ C" J2 J4 U
ns_marquee.left=marqueewidth+8
/ `% i& O2 b* Q0 S9 [8 Nns_marquee.document.write(marqueecontent)" O' r1 h+ }7 j& c
ns_marquee.document.close()5 {* n2 @2 t) [; C1 y8 R3 l% J
actualwidth=ns_marquee.document.width
0 ?) t7 `) G7 y}
- }. q! P. K& elefttime=setInterval("scrollmarquee()",20)
: y" j! x: g* x/ L* v}& m) K( B7 B& h( z
window.onload=populate/ G0 o% W# s; U# g

" y% H* o- q+ Y8 f1 z; S$ O7 Kfunction scrollmarquee(){9 a$ H4 x7 g# B
if (iedom){
& Z8 u/ p1 `( v& V1 _9 G1 {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 i# @: k) k. y$ q% j9 \2 p  R: icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 L, l* r# T6 a3 C3 o
else
# ~; I6 z/ T+ [9 [% u; g. \cross_marquee.style.left=marqueewidth+8: g! m# r' `& ?! V

# A. q* F4 m1 f}
4 y& p: \7 i& s# j. Q  u2 @else if (document.layers){7 @& i0 O/ n+ b6 o' `; \( a# P- n0 c
if (ns_marquee.left>(actualwidth*(-1)+8))+ j2 @( f% t- |. m( c+ K, {. q
ns_marquee.left-=copyspeed4 M: @6 a- R% B4 S8 X
else
1 v2 h4 B: A2 M/ z% N& lns_marquee.left=marqueewidth+8
; H1 O1 H- |3 b}
9 F) |8 e$ O1 J# h9 P}
: k6 M0 e5 e+ s
2 |& e1 x) ^8 c7 G8 m. o: E  oif (iedom||document.layers){
  q0 s0 c3 |6 p5 u0 ^5 j+ O4 Jwith (document){+ G. t. A8 a! C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 G5 M# ^/ |% e" x" f9 q% o& [2 z" E
if (iedom){# A) |6 `/ Q- ?+ c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  g/ {/ h# }3 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ u! G' e% ^+ H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 M! H2 n8 Y$ m' E4 |
write('</div>')
) Y0 P- q- y  B2 _3 G3 k}
; W# V% _/ E8 M1 P, Q/ S, J1 [else if (document.layers){3 D+ S8 y2 _8 x8 q9 f# @& g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" y% Y; p/ w  y1 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 |: S# Z7 q4 t7 Qwrite('</ilayer>')
( P# x  ^( c: ]1 l$ |5 l! A+ M+ Q}9 m* P& Y; ]! I; ?
document.write('</td></table>')
% q) r0 s$ d+ w8 Q9 O' M- B}; t5 K9 ~9 r8 r. y) X0 v
}. T( {2 ]* ~: Z2 [3 S7 |. o! j; e
</script>

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