返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ P/ N7 D+ s" H# V' q, Q5 C% ~8 V
var marqueewidth=300$ R$ J, q4 ]/ I( E* I& u* v" V
//高度0 y* U) o( i9 U6 R: i
var marqueeheight=25
5 ]2 _" M1 e# \6 t3 }//速度(1-10)
& E, y9 D  r, K( K( |var marqueespeed=3
. l2 _; W3 G! U; y//背景颜色
; F6 w4 L. C% nvar marqueebgcolor="#FFFFFF". H2 L9 [6 ~4 s% \, H: z- x
//是否能暂停 (0=no. 1=yes)?' J+ V1 f7 Z+ i3 R) p- I0 O
var pauseit=1
9 e2 a# q# w6 b9 B8 L' h. b( b& \8 {* b5 x
//修改显示内容" d0 A- S: u# f$ l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! H( r* p% l; v8 d& V7 F! z
/ B4 u: Q4 S$ |& K/ _; u* [. U/ K9 d* P2 @/ |- F8 D
////下面不需改变////////////
) V& N' Q. o* v  h/ h. ?" W
/ ^* t! J7 ~) ]9 e# Jvar copyspeed=marqueespeed
7 Z6 x+ O5 H# Gvar pausespeed=(pauseit==0)? copyspeed: 0
& K! U$ c/ r% vvar iedom=document.all||document.getElementById" P5 ?9 l9 R0 L8 Q$ }
if (iedom)
: K8 j; {: m: ~0 q( g; Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 Z/ f& K8 X; T3 U  Z. h" {0 pvar actualwidth=''
3 X4 w6 Z& U8 V( v. ovar cross_marquee, ns_marquee
( D/ p& |4 Z: b5 o) m+ I! n# v' o+ k/ n
function populate(){
9 J5 W9 P2 f, |0 X. M# tif (iedom){4 ~7 n/ G' v! J: _% }4 ?/ C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' A' I' P5 y4 R, X  b6 s
cross_marquee.style.left=marqueewidth+8
* Y9 ^) X: M1 W1 s$ w- Q7 Y, {5 wcross_marquee.innerHTML=marqueecontent
4 i  d% `0 V. J! g% y+ [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* h3 `! f+ d  z( q1 _8 {% n
}; u8 M7 }! U6 N  \* U
else if (document.layers){
* C3 M9 k/ c" S) j! Jns_marquee=document.ns_marquee.document.ns_marquee2
3 b6 {6 {# Y* ]6 H* c, D7 u  I/ y9 tns_marquee.left=marqueewidth+88 E" y1 D6 N/ H& k5 s
ns_marquee.document.write(marqueecontent)
9 A+ g- F4 [' N" J+ M2 Hns_marquee.document.close()
) Q# I% M9 |' d, Yactualwidth=ns_marquee.document.width7 j6 |6 M0 d$ U+ a' j+ E2 w) I3 a
}; S9 l6 f7 U( y2 k) ?6 x
lefttime=setInterval("scrollmarquee()",20)2 c* v2 n9 o# m/ k3 N
}
* e, x9 X& a( F" L: Nwindow.onload=populate
" ]6 t) [. Z2 ?( w
3 g9 B) s7 ^/ p2 F0 n$ X3 N8 ufunction scrollmarquee(){
) N/ }, O4 s% sif (iedom){
8 |5 K& q# m  v0 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 ?$ N. |: [8 ~& a6 ]; X! R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- h! _! m1 m3 G9 x; E2 aelse; a3 M+ g- J) D- V
cross_marquee.style.left=marqueewidth+8
$ c4 a3 E$ D8 W& y9 U9 U2 M9 _4 C7 f, T% A1 y5 n+ a7 }( K
}
( p& `* N6 o8 @) c7 y; h5 a8 oelse if (document.layers){
( _8 f/ x( H" ?" C4 y9 Oif (ns_marquee.left>(actualwidth*(-1)+8))+ n' D% y: |+ b/ A& T
ns_marquee.left-=copyspeed6 b6 m, G& v" J! Q
else
. ^; w; I- n) ^! [$ @! Dns_marquee.left=marqueewidth+85 |- I7 k2 Q) I% b9 u
}
/ ]& L9 }) z8 R/ b}2 O( x  z4 x1 G* x# D+ d
0 m2 o3 G7 @3 ^4 m% Q
if (iedom||document.layers){* i) |5 V3 m' l: G* a! Y. |; ]
with (document){1 j+ f. I9 q7 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; I$ {4 @/ @' Z( Z/ Aif (iedom){
+ ~& U) C3 m0 n3 N" w: vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& V" R' [1 V0 _" \! x1 r. ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ^$ c1 n* P; g8 }# y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( _3 J+ Q3 o- `4 J% j4 mwrite('</div>')1 K' g* w- e3 A5 \. a
}
* Z) ]" Z  n& P  R4 Jelse if (document.layers){
, q  v# Z5 a& L% H2 F* H, z" S* dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 U! }0 ^% ~0 k9 K% l! d6 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 {: n/ y  G9 X4 o3 gwrite('</ilayer>'): p/ B& b; `8 G4 E+ `& ^$ z* U
}% M; ?+ u) c1 }: R* G
document.write('</td></table>')  R& _, E9 l! o. u- K5 b
}
* j1 p( T, C7 m# [! T, X$ ?}# T2 K6 n, c+ H9 {; i5 W
</script>

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