返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 p5 x, `# H: A( J; K0 x* R
var marqueewidth=300
3 l; }, L  K* U4 T+ C! m: F//高度/ p2 \( j; t! s! G; j6 w: v8 Z8 l
var marqueeheight=25/ b. f3 Y% E+ L( W# m0 S
//速度(1-10)! t4 Q2 x; o; l% m$ s+ }, S0 Z
var marqueespeed=3; d9 [7 F+ P0 B3 a" o5 M) g
//背景颜色
; V, t1 D: |* ]: C- y! {8 Lvar marqueebgcolor="#FFFFFF"1 O* v7 V2 I2 N) _
//是否能暂停 (0=no. 1=yes)?# x+ D: U; ]* Z4 `* D4 ^
var pauseit=1& x$ W: K1 ?* t+ b- W) h1 V' j

% g# Z; a7 F/ \3 C  l//修改显示内容7 j9 C( R+ N+ X$ P* z, Y* d( ~" x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 ], Q) F3 L3 k* ~$ X8 }8 F; `
2 N  U/ f5 r7 |
: X: U$ S* w  j3 c. U7 g7 s
////下面不需改变////////////
7 R% l3 g2 z) d; i( v, n4 M" s$ }' L( {8 W! k, s6 O
var copyspeed=marqueespeed
! k. L" [3 `( y) I) s5 }var pausespeed=(pauseit==0)? copyspeed: 08 Y; L# Z5 ]3 p1 N
var iedom=document.all||document.getElementById0 _3 w$ q5 `% u& a6 v
if (iedom)
8 N* y0 T4 F1 x' @- E2 l- O9 U# ]. [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' `) ?* U0 _" Rvar actualwidth=''1 [+ y3 v/ T% H3 e( ~$ w9 |
var cross_marquee, ns_marquee( Q- f, Q2 _/ m$ s. Q; _$ {4 L
: n2 i# D9 P; x: K
function populate(){  {4 t/ {. e. M* N6 A/ M  y
if (iedom){
# Q" J1 ^3 e9 ^& X: Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 y  v0 b/ h+ S) T, V2 x' C2 s5 kcross_marquee.style.left=marqueewidth+8
" `  d, X) g( C, |7 @cross_marquee.innerHTML=marqueecontent
: k4 `& S8 Q/ j2 y, hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 }- q" X* V+ O& Y& _! A! X" c
}
' a  {# x' ?5 T7 ^4 Velse if (document.layers){. v+ C  g$ A# G3 f5 ?2 S
ns_marquee=document.ns_marquee.document.ns_marquee28 B+ f$ {7 M) l) l
ns_marquee.left=marqueewidth+8# M/ R% G6 d9 x
ns_marquee.document.write(marqueecontent)
1 n0 O% a7 s2 [# T% b+ {ns_marquee.document.close()
' f; _  g  ^) a. c# Lactualwidth=ns_marquee.document.width$ I8 p7 \+ i! t; D
}; E" y6 Q3 \6 {& ^7 i0 h& I
lefttime=setInterval("scrollmarquee()",20)( r7 c# H/ ~, j- U, Q" f9 b- T
}
/ ?2 w' `: m% e6 K; h! Pwindow.onload=populate
. B0 S$ a% b2 \9 o* t5 Q5 X) B4 M4 D8 L/ K
function scrollmarquee(){
- y* Y+ T! c3 T0 N/ u) C$ ]if (iedom){
8 p; o; s8 R. H+ T+ kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 d: w6 m# b6 E) T( R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" v* S5 p4 R' C! W$ y, N) t& o( Melse
* k5 b& X4 [- n+ G' pcross_marquee.style.left=marqueewidth+89 A7 m, [% o% B1 K, I2 T% z: [0 T, i
. l  Y" s& G8 X& d' a
}
# c7 ?. ~5 n$ p4 U- gelse if (document.layers){
7 m/ O' o: d- j) Kif (ns_marquee.left>(actualwidth*(-1)+8))1 O/ \0 z4 }) y! n0 U1 E: T. E
ns_marquee.left-=copyspeed% T3 F: Z* |% d& M# \' o$ |+ q
else& M4 ?' t! M) j0 z
ns_marquee.left=marqueewidth+8
( t# b1 N5 [2 i1 @}
$ @/ U8 x0 K  z  b8 g  ^}  w- ]4 q. i* H! l( K) h
7 j% {, l* ~' @1 f: o* T" S3 c4 n. k
if (iedom||document.layers){0 A! X4 m# V. j$ e' h7 L5 Z, H
with (document){5 i+ ]/ J( }/ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! A' ^( m- a  k* n' z
if (iedom){
6 Q* ^+ e( i; N( q* H; w! Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- f3 d4 a5 D2 R, A6 G, y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 b9 T; n6 j- M2 X2 F+ [; y! `- |5 C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 I2 H6 n/ ^7 A$ M2 _0 Ewrite('</div>')- p* R' a2 h& C0 n; k5 J
}4 V" B% O* G! y3 o0 c
else if (document.layers){) i( F, i( G1 ~1 p6 T5 l# _/ Y' x6 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): d6 M6 s3 Y8 a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ w- J- P* q1 D6 v2 t. `
write('</ilayer>')
7 V, g5 S) i( }' h9 p( i5 Y9 g; r( m}/ X- q; i3 R' S) f' m( R
document.write('</td></table>')
: p+ Q% g2 c) i}6 e1 e9 Z! O2 ^/ K3 X
}8 _$ l# p% R. {; N4 A6 K
</script>

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