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

|
网页之跑马灯文字特效
//修改宽度5 \5 W$ u! P) a) S5 A4 u7 O
var marqueewidth=300
( j) X* ^( E7 {, P. l//高度: I1 ^3 V* o0 V3 ~5 y/ q7 r
var marqueeheight=25
6 I. x- B) P( O6 K0 E4 G @% g- j//速度(1-10)
" T9 L5 E9 ~( J$ [var marqueespeed=3
( y. s& I- R9 N9 H* t2 J6 ~" ~6 T7 q//背景颜色
( g- K b, w, b2 k- bvar marqueebgcolor="#FFFFFF"
6 Y$ R8 L" @1 V/ W8 S# Y//是否能暂停 (0=no. 1=yes)?/ ^. H J1 C7 v4 s% ]* W) z' y
var pauseit=1
: B, v* R4 b" x
) k2 F% l- a7 o, G- X8 y//修改显示内容. w& [4 T0 U. G& q3 k7 ?! L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ [4 B- L0 p( M& }2 `3 [$ n
* [ e8 ]! Z- u! Q' }1 E; c% Z
[& Y1 D( @8 o/ ]( _6 @5 E
////下面不需改变////////////3 f# ?: G; f0 O
; F- q: a4 W" E7 q+ w% `var copyspeed=marqueespeed5 U* n, T8 O+ R+ ?2 f
var pausespeed=(pauseit==0)? copyspeed: 07 v! I/ j$ C! u: V
var iedom=document.all||document.getElementById
4 q" `7 z. V! s- Yif (iedom)
`/ i" @8 @( f( c) idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, q% B0 C% ^+ q* J* avar actualwidth=''
+ S: ]9 s/ g' `6 y: Z+ kvar cross_marquee, ns_marquee1 f6 M: v/ W/ c: D; A& p
' q) \- {2 N& A. }; Ofunction populate(){
. N, d9 I* n6 ]5 a1 {* ?( Vif (iedom){0 M0 b/ R$ ?6 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 _( c' Z0 Z6 [5 ^# F$ y
cross_marquee.style.left=marqueewidth+8
8 c3 M4 d: Q1 ^6 P) D8 ^cross_marquee.innerHTML=marqueecontent- c% J! Y' ^4 J# ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, D# H* g' v+ R% l# ]6 N1 v$ `, V}& F6 B) j. Z! e- N+ l% [
else if (document.layers){
, J. _- H( |6 H' Vns_marquee=document.ns_marquee.document.ns_marquee2- y9 B9 d3 H% ~& N8 N6 {
ns_marquee.left=marqueewidth+8) p z2 V1 s& k- \- W% [
ns_marquee.document.write(marqueecontent); u8 u! \( I( ^& O: s& W
ns_marquee.document.close()
7 V7 S: N9 _9 T2 Z' C8 {actualwidth=ns_marquee.document.width9 F# L) e0 Y2 T9 {' g2 Y
}
" w! H) a- e. p- U/ S0 R. q0 @4 Alefttime=setInterval("scrollmarquee()",20). P) ?0 M. y; k
}! i8 p' m# o: Z9 S7 ? \2 v
window.onload=populate
' [' P9 l" Q1 o2 e
1 V1 p' G* t. ?& Ifunction scrollmarquee(){
4 z; Q- j& j8 O" s# ?if (iedom){# R! L, b5 j4 P2 {4 e6 ]: e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. i0 _- ^) F& s+ Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 F5 o5 y# Y/ V |' Felse
+ |! o$ B, E- c$ K1 A1 bcross_marquee.style.left=marqueewidth+8
+ b( ^/ f; X$ ?8 z; c& T
. w2 f- h: n/ l0 I: h}, `( I; G; V+ B4 ^% g0 Q+ T
else if (document.layers){7 V! J! k3 \- _
if (ns_marquee.left>(actualwidth*(-1)+8))
. y' g/ b( x2 r4 `$ E3 H8 ]ns_marquee.left-=copyspeed
3 d. D0 Q7 D. l2 g* L; h2 u1 telse
$ P0 G3 n8 m8 w" y, wns_marquee.left=marqueewidth+8 P Q. U4 q- m5 a
}
7 y, j: T1 f! r7 a& Z1 z/ |}' K5 Z x9 @& w( x4 }& J
]* d& z9 s( k) {+ k' M3 Mif (iedom||document.layers){- j0 F5 F- a) s c3 y
with (document){
; x+ @# I1 A/ T# ~+ S# Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' w& b6 l$ w& `0 d5 Pif (iedom){
Z2 |8 B7 W% n/ V1 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ {+ k; Z [! |! z% C3 c* P$ Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" I5 J- C+ {* l E& Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% F; A' {, o, C& ], N
write('</div>')
, r& P& v' d% v) j) {" a! a2 ^" u7 L5 F}
, h) W* b/ z( J4 r6 Q1 Felse if (document.layers){
1 A0 m, `9 H+ F. ]1 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( w* f7 `; z2 H% ~- d/ f$ Q* hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* W) z# t6 n1 B" [4 |' F
write('</ilayer>')
8 n- i# ]) ]( _}4 ~. @+ G O* u( ^$ @) K8 e) j
document.write('</td></table>')
5 o v0 A. b! V+ i6 ` [5 X}
! E3 Y, ?1 V2 F}
. r0 }/ c& D- x</script> |
|