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

|
网页之跑马灯文字特效
//修改宽度8 D4 A6 w* N3 L* z
var marqueewidth=300
( \. l- ?7 r, k- X( ?) |. R8 k//高度$ `# v( Q/ Q$ i4 b, Q
var marqueeheight=25
" F1 n1 p2 }2 j! |# n6 Z//速度(1-10)
5 B" |+ d9 H9 g& h2 @" Xvar marqueespeed=3( V/ O% S. E5 ~9 \: C
//背景颜色
- \2 M1 \! J1 ~# {: Bvar marqueebgcolor="#FFFFFF"
5 @: H% n6 P) }3 z- M% n//是否能暂停 (0=no. 1=yes)?
o9 L! g$ ]: _- S3 Y' Zvar pauseit=1
$ L% ?: z- L9 t" X7 [+ z; @1 |# ]# M0 i9 s
//修改显示内容
$ {4 V, X' U2 [# }- x$ t+ l: ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ w' k9 a( n* q; b5 u0 ?3 p
% a+ } S) V( _) r: H8 `- [: s
' w2 q! ~* c0 q& e4 k+ k& [+ K' q4 [////下面不需改变////////////
+ N( z6 ]* V& z3 W- o
! T' V/ D3 U1 u6 a- r& b5 }! b- O2 zvar copyspeed=marqueespeed
, `2 L) P4 I2 _# h4 t: }" ]6 Yvar pausespeed=(pauseit==0)? copyspeed: 0* t7 R% v6 N4 P
var iedom=document.all||document.getElementById5 J; C/ _% R6 T/ \* P6 }( @
if (iedom)
- x6 k" T! Z: ]5 H: r/ Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). u- N7 d0 R& I! r
var actualwidth=''
. B% L0 W9 R$ @6 i8 W, qvar cross_marquee, ns_marquee7 I" L m" v: [( G! h
2 x/ ~" l) c" K" I0 Ifunction populate(){
5 j4 D9 c8 [9 `& a3 y- _if (iedom){( \8 K" h! _- L" X3 s+ q# j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, a5 g6 W2 U0 t! K. H
cross_marquee.style.left=marqueewidth+8
9 A1 |3 `, Z4 L& W7 a. n& ~cross_marquee.innerHTML=marqueecontent3 W+ F; L& g+ J- C9 {8 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; W! H$ D$ A, t! U, x
}9 n" m5 a4 Y3 c" Z( |
else if (document.layers){
4 U/ `" |& T3 p: Ens_marquee=document.ns_marquee.document.ns_marquee2% {! o4 d5 U2 U4 P$ b: x
ns_marquee.left=marqueewidth+8# a1 S8 A+ t; ~0 a$ Y# h, l( {
ns_marquee.document.write(marqueecontent)
& [2 C y" W9 b3 V1 e3 n0 b h$ gns_marquee.document.close()
7 }% U9 O/ D. K6 z: ]4 q& Z& Tactualwidth=ns_marquee.document.width
% C5 N W( P' T0 E5 q# |}
5 f0 v3 U1 g1 R, E- Y% q' vlefttime=setInterval("scrollmarquee()",20)
$ { q, R/ b3 U3 a) o7 O6 T}$ |1 w3 g! @& }4 G
window.onload=populate
2 ]2 W5 z( _8 D w
) i# r0 p! A+ t5 e1 f" Afunction scrollmarquee(){
! x2 R! I5 @; R! N/ N# z, ]) uif (iedom){
: b/ r9 ?! V. {0 F: h. C, K5 S# hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( i% r: Y2 L4 b. e: C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, @2 k' L/ _2 A2 _$ melse
- c+ D( ]1 K* z; lcross_marquee.style.left=marqueewidth+8: q# Y! R' q) W$ K2 K; `$ D5 F* }
" g' `6 K, p4 b5 e8 }}
5 E2 g; j5 f' H: Welse if (document.layers){
% w2 x4 c! r) |- J# Fif (ns_marquee.left>(actualwidth*(-1)+8))
& o6 _ n/ U; z; Vns_marquee.left-=copyspeed
1 x4 w6 W) t, Q1 J' L3 Uelse9 _$ ^% [0 ]+ J" s/ k( ~
ns_marquee.left=marqueewidth+8! A. W+ H8 V; c+ x( @+ b
}. R5 e' F1 D$ M) j
}
/ X8 }! {4 |; O5 e/ c! c* n
( e* }5 e! i- j: g( \7 Wif (iedom||document.layers){
- `# I& ~* |3 H* q" \- W; Rwith (document){
& E) n) G |( ~% h1 {4 h" Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& L5 i; e% S# {$ }/ L! R
if (iedom){
8 H8 z; e1 K1 Q1 l( `" _! iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 @8 d4 d: ~2 i7 g2 W) e3 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
k/ ^ M5 v$ u$ o# e& @9 b Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 o- v8 H( {% C% j, l/ Awrite('</div>')
$ P# t( R1 e7 N6 U! v" a; a1 L! |}
* G3 k9 x$ S" h+ x2 uelse if (document.layers){
! ?! _0 c) s m$ \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 C" q3 o9 D S/ C: K L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, j8 _1 d8 @8 Z* H/ F2 G7 m' _write('</ilayer>')4 l3 D5 t, T9 _" {4 T. m( C
}
. ~7 H8 Y1 o2 }! Pdocument.write('</td></table>') N+ c3 k1 J7 X0 ?
}
8 Q% N3 d- w8 e6 g, k( |+ t+ T}
m) {3 j% _8 X" F4 D8 {$ u/ Y2 B& a% l</script> |
|