|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
8 ]4 m2 p0 Z8 ivar marqueewidth=300
* Q2 [! f; U. ^1 \# ` H' @4 k' Q3 A- b//高度6 }6 Y G: r& t; X* b; ?
var marqueeheight=25
! k$ _1 q y( L# r1 d//速度(1-10)
! V& ^& Y4 }- @2 g' Q- H# Mvar marqueespeed=3
4 B0 W' B( e8 b H6 }7 }/ J//背景颜色
$ A1 k( r2 H; a% v+ \( Q* a1 `var marqueebgcolor="#FFFFFF"
, S$ y/ m3 P8 C: k$ r, p* l f//是否能暂停 (0=no. 1=yes)?
- ~+ n. f3 i; C- p# X" Jvar pauseit=1- b! x- i# Q- k" H3 p
6 I- E# n) w% P0 ^% h6 e1 g
//修改显示内容
% o" S6 P! v! R# n" ]/ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; P0 U% A$ r) n; a% k/ d! K5 u ^$ e. s) A) h9 W
* C2 I& t) b8 [6 V; N////下面不需改变////////////
7 c, s2 G+ S% `" o3 R; O( U* y x- j h" L7 M2 C1 m
var copyspeed=marqueespeed
6 a1 K$ U% p9 S4 W: k& A. ^var pausespeed=(pauseit==0)? copyspeed: 0
+ z# W% ~+ t+ P* F1 h5 U$ Y7 X6 Gvar iedom=document.all||document.getElementById
" V$ c" }& w4 v. v$ Hif (iedom)) q# j6 G" n. }7 p4 i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 o+ U4 }8 e: o- i
var actualwidth=''* b$ M9 E* Z( d. S
var cross_marquee, ns_marquee
8 [( D/ s* O- R3 P8 \/ w; M# A0 r8 a' \ B
function populate(){
9 |. D8 j; q ~if (iedom){
9 L: k3 }. \3 U- q4 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' ]6 w+ t! v# e
cross_marquee.style.left=marqueewidth+80 v! }! d. q/ U) Y) O* K9 z8 r
cross_marquee.innerHTML=marqueecontent! d4 ~( E' y5 P& ^& Q8 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 V u% @9 S: Y* T1 f6 H}8 i* _* L3 p; E) X) \. b1 o' h
else if (document.layers){
" q2 N" ?1 @( W3 H& Ins_marquee=document.ns_marquee.document.ns_marquee2+ L& i8 Z! m4 [7 \& V) Z+ g, p7 c
ns_marquee.left=marqueewidth+8* U# S3 V0 q* D, f( e/ p" Q8 [5 Y
ns_marquee.document.write(marqueecontent)
! H$ Q/ z, v- G! I9 h0 Q Uns_marquee.document.close()( t1 ^' `2 X6 X- l( @5 [
actualwidth=ns_marquee.document.width
! b3 G% P% g" X2 L. n7 _}
8 u" B8 G6 H3 T+ Z( K/ Nlefttime=setInterval("scrollmarquee()",20)
( P# D4 z: u" k8 K% T% N}
: g5 U! q* `9 D% q. Ewindow.onload=populate
9 L" m* B7 T! N7 [# u; B5 i
; S5 t% E7 s y+ ^$ Mfunction scrollmarquee(){
; }) ? v- Z! Q+ [7 hif (iedom){3 N" v9 l1 f7 M) `4 d+ d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 B# k( ~2 |: u0 o: Y; Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: W, w6 l9 R/ ~# b3 t- T, G Jelse
/ T" E; I7 c1 d0 @! J. Across_marquee.style.left=marqueewidth+8
7 w( A& D/ i$ o: [" v$ G
* M2 i$ [) t, j8 B3 D) t}
' r+ {$ B$ n% u' r, z- H2 Gelse if (document.layers){
* m" N& V$ Z8 U2 h, J0 sif (ns_marquee.left>(actualwidth*(-1)+8))
: F9 }0 U% }$ l0 R1 a6 ^+ nns_marquee.left-=copyspeed
+ P- b! t+ ~4 Y! {, z9 Velse
/ u- ` |- y& t/ mns_marquee.left=marqueewidth+8
8 c$ o! d5 G9 \5 m9 ~2 P( S}; `. m- I- g* P' z6 e3 G
}3 _* ^+ V; ]: O: C" W4 Z
0 {. q, o0 h5 }0 x) `# Pif (iedom||document.layers){
# j) V6 o- g7 y0 Iwith (document){
0 {7 V$ ~: n8 R) |, cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" o( y. s+ M5 ?4 `
if (iedom){
2 U: Q/ p3 [+ u8 G4 A% T1 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. R1 f: J7 l8 p: d; j; _3 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( t8 r! e" n: H6 n5 Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# T4 q+ }: b4 H! Owrite('</div>')+ Z4 v6 \) p. @: P+ v: p! Q
}
# O) {! l+ }: G4 n3 x2 K6 j$ Q1 R8 yelse if (document.layers){ d0 w# T/ H1 i6 z, f/ X6 [( A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 Z7 u9 R: ?% ~( n2 L8 |. @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 X% @5 f) ?, c5 K2 @write('</ilayer>')* c: D& b/ E+ p
}
4 ]& b% j1 a+ [3 m* W6 i& fdocument.write('</td></table>')$ v/ B% h9 h$ o
}
/ w& F0 t# g: X/ D}. R+ j* t. o4 i4 t# a# Q
</script> |
|