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

|
网页之跑马灯文字特效
//修改宽度
! r) C, t% m, v6 ~: S# q4 ovar marqueewidth=300
. X. m) \7 t1 d# H//高度
+ g' j, t) `- P9 O8 `$ jvar marqueeheight=251 ]4 k+ v. w" _( ?3 T
//速度(1-10): Q7 h9 y* O6 |0 Z# W2 s Q
var marqueespeed=3
7 n+ |$ W# u! q+ N& e) ~6 Q- z//背景颜色
6 J( J0 A0 \, Kvar marqueebgcolor="#FFFFFF"( E: x6 ~4 c d; n, t
//是否能暂停 (0=no. 1=yes)?
6 }3 p/ M% H9 n. Q: Y$ _* x. [var pauseit=1
$ X0 `5 A( X% D7 x" v3 m
( b, c) h( c% K* ]/ O//修改显示内容
/ s* J" K8 g% w4 r) w1 ?7 K; f3 gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 }" @2 E1 p$ |# ` D
8 T5 B1 {% R* H& M p- x2 F, |. u c1 T% \: ?# H" ~! o
////下面不需改变//////////// l: U1 J* U. L: \" j5 }
. N: a0 K5 o/ o" X1 d6 fvar copyspeed=marqueespeed
, @$ t5 \( p9 Q& i1 R5 Nvar pausespeed=(pauseit==0)? copyspeed: 0
& _4 O+ L& B8 h' y* u P8 _var iedom=document.all||document.getElementById
* b0 q3 _* b2 N! L( ?" K) E; Yif (iedom): _; V4 [5 s' x' ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ l1 T( g- e" M2 v- h. U
var actualwidth=''
* ~9 O! \$ A2 _, K6 O% tvar cross_marquee, ns_marquee4 I: M% V5 l9 R5 n: m
' A( u* H* Y7 E x# Z
function populate(){
7 m6 P/ m/ _' _8 h2 S4 I O3 lif (iedom){
* j3 @9 B" O: J# Y* Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee n d0 [/ B4 q4 m
cross_marquee.style.left=marqueewidth+8
' u) A0 Z F# {2 C% Y7 ?% ~cross_marquee.innerHTML=marqueecontent
4 j% Z! v1 z( e8 t) zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: r. D% G! ~. v}
5 f1 g+ Y; |: A6 J0 ]( C, u* ^else if (document.layers){
1 v( }# ^! e1 W( Y5 V4 j! hns_marquee=document.ns_marquee.document.ns_marquee2# I+ S) B/ A* u* c
ns_marquee.left=marqueewidth+8+ n7 r2 D# D7 K8 o9 H
ns_marquee.document.write(marqueecontent)
6 o3 t/ a2 ]5 l8 J- `( t5 ins_marquee.document.close()
+ _+ l. t9 p7 @: hactualwidth=ns_marquee.document.width
1 ~7 h g- j% G$ q3 Y8 F}5 M: I& ]; Q( i
lefttime=setInterval("scrollmarquee()",20)
' k% b x) s! I% B3 `5 n}
, L5 U) B" o9 u+ R8 ?) J4 Lwindow.onload=populate
& q) U' u8 D4 D8 J# c
6 a$ N3 V) H0 V! n3 Q! Y# |function scrollmarquee(){
0 s$ c! N, h' ~4 P& m+ r9 Z/ yif (iedom){+ L6 l" ]! s! Y2 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( Z1 U* i- i/ n/ L5 d" u- \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ c' a; c5 H) j- G& G9 i; n$ q
else& j# l' z7 S6 |6 @1 |" I
cross_marquee.style.left=marqueewidth+8
- M. X Q# y' E. w5 Z' h
* _# B* p# h) ^6 E0 }) s- P/ P}, i$ y0 i( N% C& G* b2 {# h8 g
else if (document.layers){
+ _+ n- F/ g+ Oif (ns_marquee.left>(actualwidth*(-1)+8))
( Q6 u; |' m n* E8 b$ kns_marquee.left-=copyspeed
: w8 J; {& Q( S K* }$ E$ Delse. v" o4 l7 ?' |8 A9 G; b- `
ns_marquee.left=marqueewidth+8
) w% b7 P! F$ G' t) y}* Y, z8 v; {4 E( G
}& ]. r9 x1 ` R- a
_0 `! u# \# _ A. d
if (iedom||document.layers){
+ C; N \0 a- T) j, c7 C0 c7 q" w" Kwith (document){0 P5 k, d# J" }$ A- S( O8 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( \. W# ^7 S: z- i* ?" h
if (iedom){& T1 `8 y7 G- [, t, ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 }! u P: t# b/ o# [2 V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
Y; Z. z! |6 p" p8 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): @6 H$ c4 K1 X% @ o
write('</div>')
P! ?/ \+ Z5 c2 E4 |; \}- A" W2 q3 {1 h( ~4 E0 W9 a' `5 F
else if (document.layers){
' l8 N) V, Z+ zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; k0 i- T" n& S7 O3 @- e; ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: Q6 V$ Y6 Z# n' P9 @write('</ilayer>')
( u1 c( `/ u! Y# w}7 W6 z8 F- N( `3 _- F4 i+ ~
document.write('</td></table>')& W g+ {2 t5 X: U& z, `
}! F/ C! f2 U8 i
}# Z1 N! { A% V( q+ P! M4 B$ Z* |
</script> |
|