返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 ~6 @# _8 [% Q5 L
var marqueewidth=300
7 Q' R- Y2 Y5 L1 P+ s- l//高度
( Z! L6 [% E) c) K9 F# j8 }! {var marqueeheight=25
, J1 |" L1 Y! L! e, O; C7 ~8 j8 x9 s//速度(1-10)
, W2 e) P# e2 B, Q. cvar marqueespeed=30 V. z/ t5 D$ j, z9 G
//背景颜色
1 T0 _8 f6 m# M. X, O  ], c3 @* Jvar marqueebgcolor="#FFFFFF"
/ R8 m3 S2 U3 p( O0 J! o//是否能暂停 (0=no. 1=yes)?
7 @/ S; f- L/ [" m' F' evar pauseit=15 U  j. L6 S6 y! m5 @4 p  F
- X  H5 W" S: A% n' T+ P2 H
//修改显示内容
7 \8 ^8 h& O% v. L3 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% `& D; [( N$ W- Y! a. j9 f6 y6 ?" ^

- U* t8 |- f/ s  S4 I
1 z! K6 r' [% P1 N* M# [2 K* K8 ]////下面不需改变////////////
! q, ]- S* I. {- K8 C4 b2 v+ K; ?  r1 l
var copyspeed=marqueespeed
* ]- e( \) \4 E: l8 Wvar pausespeed=(pauseit==0)? copyspeed: 0
' i& J& H* M* V- u) @* g- f0 d7 Avar iedom=document.all||document.getElementById; j; @$ B8 T6 q: i7 @& ~* I
if (iedom)
3 I) B3 j6 {; I+ f& f( p& j2 pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 X* ~: |9 j5 E- j, I( G2 _
var actualwidth=''
( g2 Q$ B0 g4 M7 Y) ?var cross_marquee, ns_marquee
5 m# c. v4 A) _' j% N- j) U' f. R6 b: t' ?5 T3 m
function populate(){
  s3 \4 y7 g- Q. z) h0 mif (iedom){
9 D, E: [- D+ |, c! Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ d+ ~& B0 M: `
cross_marquee.style.left=marqueewidth+81 h# h+ G" Q1 C6 m  b+ E8 |
cross_marquee.innerHTML=marqueecontent" j- t3 a- ]6 H* Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 C3 [& b. S! R/ c% C- |; t1 P5 w
}
  C/ P, m" H6 X1 R6 V2 x+ {/ uelse if (document.layers){
( W' D* {; h  a5 X: Y  Vns_marquee=document.ns_marquee.document.ns_marquee2
" E$ |2 g& ]. E8 I! Yns_marquee.left=marqueewidth+8
2 I$ T2 T) u9 qns_marquee.document.write(marqueecontent)
5 z9 n5 a: V7 i8 a6 {ns_marquee.document.close()
; V6 Z! E) H9 {* ?3 q; jactualwidth=ns_marquee.document.width2 V% Q& z7 G+ H. s  F, p2 t8 r
}
+ Z5 o( l: b" Z" zlefttime=setInterval("scrollmarquee()",20)
4 y+ l2 C) \/ l2 L1 L0 i}2 p  ^( c# B* U, }+ X
window.onload=populate% u. n7 P6 ]' E, ]4 O
$ R3 s# k. o3 W5 V8 F, A
function scrollmarquee(){3 e1 E. L4 @% x: f/ e& K  g
if (iedom){# z# w3 V' h8 y6 M# W) h- A. r
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. z8 `$ M6 s+ O* Q* J8 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 M, A4 e7 l% u, x" N: b
else' [% {$ m' {) h2 q. m
cross_marquee.style.left=marqueewidth+8
3 V4 I, K6 L4 e/ R+ y2 k. \3 J4 O$ p, {6 O0 z2 \
}, M, n  Q" f9 j
else if (document.layers){! ^* `* h2 t: F
if (ns_marquee.left>(actualwidth*(-1)+8))
4 ~1 m% s7 W3 Z4 Uns_marquee.left-=copyspeed
' G) f7 U' y# t$ i, v- ielse/ V. ?4 y" j1 w3 C3 A
ns_marquee.left=marqueewidth+8
2 \. T. ~% o! X/ N. U4 r3 X}
& W+ }' x4 u4 Z) @" b7 T7 o}) O- F) k$ J+ U1 L5 p* F

+ P; Z- q3 m% Q$ G+ fif (iedom||document.layers){
6 l( S* B! m" k" b% ]with (document){6 Y" Z& x# |9 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 G3 @) _- ?: ~- |5 d
if (iedom){
( d9 w1 X0 L. L1 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 V* S$ H+ z1 m- i! H: u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ G  J- S- h  T  Y, E; f% x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 K7 {; ~2 `# Q- ^8 o% I, `
write('</div>')
2 ~# z* N$ v7 y6 ?}7 w7 M& O" P3 ?, w) g, D7 H% F
else if (document.layers){
9 n4 @8 M9 m' |" R0 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 j( u! V: a7 c$ W" N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 v4 ~3 |" D7 t! S/ t$ W
write('</ilayer>')& l0 l1 M2 y4 Z# z
}4 r! J. d3 k; {# L( k; A: b
document.write('</td></table>')8 n$ g& z' i, H! x& Y
}8 w$ R! S" Z0 Z$ |. L) `
}6 I; L; v; K' z9 u' K. S
</script>

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