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

|
网页之跑马灯文字特效
//修改宽度
( G5 C) _" s* t- D3 j$ M$ o3 ?var marqueewidth=300
/ I- p4 G; d- w0 z//高度0 p( E; D/ G$ q" E: u( ^' b
var marqueeheight=25
# A5 n4 X5 W- a: `: t! t) w//速度(1-10), C' Y( g. Z$ \( d" U
var marqueespeed=37 X) c- m4 I+ W" Q4 f7 p
//背景颜色. `, f& i5 ?( V+ N6 y! s
var marqueebgcolor="#FFFFFF"; R4 C) P) l- \4 x
//是否能暂停 (0=no. 1=yes)?
6 h& n r5 p' b r7 Y$ r+ m7 Vvar pauseit=1
$ N* W( X7 g8 D& `9 K' e3 @2 H6 h. e" L/ y
//修改显示内容
2 T6 M' ~, \: {2 v* {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& k8 U7 \7 H: f0 D0 v
: M$ ~: x9 E" T
, G' _# Q1 t5 z# `////下面不需改变////////////" D- U! _6 `3 r
7 q x1 g3 x: ]( Y2 m9 g- L
var copyspeed=marqueespeed* o! r; S, C; L6 u+ I A3 X9 {9 H
var pausespeed=(pauseit==0)? copyspeed: 0, l# b5 ^: C6 Q: q& \. s
var iedom=document.all||document.getElementById
, l9 k1 R2 C/ Aif (iedom)
: |; y- @. L& [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, g# ^% k' O9 Y" V& P. vvar actualwidth=''5 g/ G$ K/ f% i1 q5 c
var cross_marquee, ns_marquee! F3 F; a, w$ L. ^' D' B
5 ?* s9 `! M; l; R1 L
function populate(){ A+ p) K; d) N0 ]
if (iedom){
- S8 d% q0 l/ M. jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# J( n- [6 n- ~0 mcross_marquee.style.left=marqueewidth+8
1 E: _& T S5 O9 i( p" ccross_marquee.innerHTML=marqueecontent
, K+ s5 c( M4 K$ z! C' Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ |8 R; L: D |}
7 ]; G- _! _; G6 Gelse if (document.layers){
1 i4 K k2 ^" o" l q- Bns_marquee=document.ns_marquee.document.ns_marquee2
" T- x& \4 i1 e8 @) Pns_marquee.left=marqueewidth+87 l% K, I! {) B# P: g
ns_marquee.document.write(marqueecontent)
0 _" Y! A6 L$ |ns_marquee.document.close()
w* a7 e) ]; N" kactualwidth=ns_marquee.document.width, r4 I3 G0 E+ h' J9 R G
}
4 e y7 J( V5 g+ `9 t7 ], Llefttime=setInterval("scrollmarquee()",20)
3 ?3 o9 [* u$ {! |}7 v8 Y# ~1 ^& @& C
window.onload=populate
^% G3 ?2 z1 I! [ M" z4 a+ v4 Q: I
function scrollmarquee(){
* D n. z0 K6 i- Xif (iedom){
4 N& Y$ ?! s1 [. J; c. c7 R. d5 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# A; c6 f4 v! [, Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed f6 _# D: Z5 a8 d
else1 R, @& k' b! E1 u
cross_marquee.style.left=marqueewidth+8& D- M- c O- y4 |1 ~: _- C/ P
& v: T, G [; h
}4 E+ p1 X$ z% b- u+ z# T9 H7 ]
else if (document.layers){$ _1 p* P7 Q/ _+ T6 u! S! u
if (ns_marquee.left>(actualwidth*(-1)+8))
( d1 ^$ X& V% {/ q% ]* W7 \5 \ns_marquee.left-=copyspeed. }) w U V1 w: D) ]9 L( s: k! @2 Z
else
& L' ~6 n4 ]3 n- kns_marquee.left=marqueewidth+8. e2 h- d- N( O) F( i6 x
}* w) [+ H0 s8 } R' B, V
}6 |1 H q; w/ B& H1 ~/ |) t
) X1 q7 ~# P: a1 k% A. I2 @
if (iedom||document.layers){
4 Q/ K& P5 N l1 Twith (document){
1 ~$ ?3 [8 _$ e, Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). k0 U. ~9 E. n ?! ?2 E
if (iedom){
0 n B+ I0 _3 w: Z2 G; y, awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# y& z L" k! E2 y" fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ [% \$ |; ?% w( C0 H* c6 F* D7 c. f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 ]9 E5 E, }' M8 zwrite('</div>')
- I5 W3 Z p' _5 O: O+ y}+ z" @4 W. A2 ^
else if (document.layers){2 h6 ~4 t% d) m- w1 W8 J* j2 L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! r+ @) ?) _% I1 l4 J7 u( c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ i: t1 _2 U+ Z+ j2 x1 F4 y2 zwrite('</ilayer>')' K, d# \3 N5 E% U* v- ]7 C1 W6 A6 m9 [
}
8 k9 }; H- `3 vdocument.write('</td></table>')) d1 O9 {$ d4 j6 a% {
}
; y4 U; [+ h9 q1 k+ a7 O}
3 S: |$ F+ }4 ^* v, D5 n+ l" @# K</script> |
|