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

|
网页之跑马灯文字特效
//修改宽度' i4 N& f1 T2 f& Z' j
var marqueewidth=300
9 q- f1 h, B# V7 J! ?( F//高度2 m, t5 _ c% D
var marqueeheight=25# h ?, V' ]9 p/ j4 w: s' A
//速度(1-10)
5 D Y7 Z1 A' P+ E jvar marqueespeed=3' q! s9 e' U6 A! X( @
//背景颜色! K0 y0 P. A1 |7 J0 [
var marqueebgcolor="#FFFFFF"
/ `# y' i/ h; M, m0 ^//是否能暂停 (0=no. 1=yes)? c0 X! H* j7 C! E( {
var pauseit=15 t6 C% R/ R# h7 I7 z+ L
+ p: ?: r0 T, `& y% V//修改显示内容2 Q/ o3 B8 p) O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 j3 A3 Z, ]" `7 J
/ t5 _' L& u7 k- X
; s/ a. x R, `8 q! {* I" c////下面不需改变////////////1 w- e1 b, P0 D: j8 @. y) k* I
2 T% K' f( N* ]$ }var copyspeed=marqueespeed9 V3 F; W' r; {3 W9 E& g
var pausespeed=(pauseit==0)? copyspeed: 0! ~' L4 O# O# j3 B9 q& k
var iedom=document.all||document.getElementById- S2 }/ A$ _9 V) x/ E1 j
if (iedom)
8 c) Q4 Z/ X4 f$ z8 \( f9 N& ]5 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ g' s" q7 R# V2 P. j
var actualwidth=''! o+ B2 z( o+ W0 i
var cross_marquee, ns_marquee
9 L. h& {' r6 T
. P5 G1 R: i# e2 ]& t. [. Vfunction populate(){; ], `) {6 ^" s% }6 K3 _6 }
if (iedom){
( s6 } s! D" F: w1 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 X7 o# q" V5 K0 _$ l9 O- b5 n$ ^
cross_marquee.style.left=marqueewidth+8
3 b% p% w0 ^; [' Y v, J4 Ncross_marquee.innerHTML=marqueecontent+ d% O# C/ t( I+ {) _; m- @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( k/ t. q8 |$ B; D}
2 G6 { }2 O8 s$ i( O+ F7 Y0 qelse if (document.layers){
: C4 C+ B" L/ vns_marquee=document.ns_marquee.document.ns_marquee2
- n" k. U5 Y; g; y0 ~2 n$ C$ Uns_marquee.left=marqueewidth+8
7 i) I4 t7 j3 H1 E+ {* G9 `5 `ns_marquee.document.write(marqueecontent)- G$ J/ X T/ w- i7 p) q3 v9 l/ z
ns_marquee.document.close()
8 r6 A7 V5 Q/ g6 U* b+ N4 _0 w1 vactualwidth=ns_marquee.document.width9 v+ g* D; k5 } o
}: t! a9 L3 {8 ?# a. K! Z8 s
lefttime=setInterval("scrollmarquee()",20)
+ f: G7 R) E" r6 S2 v}2 x/ x& t- [: i6 R0 U; v1 z
window.onload=populate5 L/ R3 A2 E; E
9 m# d e9 s* e" f% E4 c: D
function scrollmarquee(){
" G" q- p3 q0 ]2 j- Z I( s- Bif (iedom){% |6 l( [) ^( S. _' r+ l. C* w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" L. x2 v; [- Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ a. ]5 W* h4 O1 y% o( C- Belse6 b" ?* D# y5 G6 h- A$ M
cross_marquee.style.left=marqueewidth+8( S, v6 y O- L7 c% m
9 N; k6 Z; H2 G# [2 c: z9 A6 @
}
+ ~. m" N$ U. ]9 M$ }) X' X! ~5 M, welse if (document.layers){
" ?1 Y" X: m5 U# {# I6 ?2 M. g+ Z9 o0 |if (ns_marquee.left>(actualwidth*(-1)+8))7 G6 r' [9 }4 _
ns_marquee.left-=copyspeed& q3 y/ j: P8 z0 b
else
/ u/ l1 m# a. I, n, Q! y4 P$ I' m7 Sns_marquee.left=marqueewidth+8
1 M ~+ q) L3 j}* d, H# A/ j3 M1 y
}
" P) k- m" f; d; b
* K) u) v: l6 L# {% s6 `+ Oif (iedom||document.layers){* ^* a5 K1 H* q6 w. }$ J$ Q& q
with (document){7 b" ^6 r9 [3 z8 _5 w" L$ L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 N0 L, \3 i' F/ z7 o+ ]
if (iedom){5 j" m. ^3 ^$ L: L2 A9 N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# b, o- v( e& e. {2 [8 [5 vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 Z0 @/ s* o( m, k% u4 J4 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" b& m: Y/ e( H# w0 ~; m% G) }9 dwrite('</div>')
. ^+ X9 ]% x( z( F1 P g1 h; i}% w4 ?) D& c& o6 Y1 C
else if (document.layers){
, p: D8 L- Y/ J6 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, H, l% m, g, U2 K' @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 F( c4 a3 j% _) c9 e" @
write('</ilayer>')
( [1 g5 A0 m1 k% `5 ^$ M6 ]* f2 L2 Q- o}
# }* _- s+ F6 ~: S2 i+ d. pdocument.write('</td></table>')- m/ `4 ]# R6 T: l/ L
}
' i0 i1 \7 o& t! |) e4 _' I} U! \% C( J+ T4 v5 H
</script> |
|