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

|
网页之跑马灯文字特效
//修改宽度) F" I2 [$ o% L! b K% t2 B
var marqueewidth=300& t R/ X S8 B) o
//高度! [! b. ~4 s# h9 `" C
var marqueeheight=25
" Z4 |: Q- c% Z( v//速度(1-10)& m% `% e7 \4 D7 g7 U+ Z7 f9 Q
var marqueespeed=3
: f. E) {/ b, {7 a/ N//背景颜色+ `+ x' K x" ^$ ~6 G6 d! E; N, f
var marqueebgcolor="#FFFFFF"
; }5 X& l3 d; C5 C//是否能暂停 (0=no. 1=yes)?
, J0 n' E/ N7 ~, n6 F; E+ pvar pauseit=10 _( n: L. Q0 }$ T9 z4 G& u
' a1 L7 G% u3 _7 R4 I. ?7 i' S, K6 J//修改显示内容5 r, R9 I o6 b5 p1 F; n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 o0 `0 u ^ b2 t% ^4 V( q
/ ^0 [6 x& ?, E4 {+ M6 w+ o# Q5 n2 D; u) e: ?# B# ?
////下面不需改变////////////
' ` n9 L3 F+ q1 M* k3 ^, J" R o' N7 B1 I; q( [0 m
var copyspeed=marqueespeed. m$ ]0 G, l; [, s
var pausespeed=(pauseit==0)? copyspeed: 0
- t/ q9 O6 Q0 \8 \var iedom=document.all||document.getElementById% s6 C8 ]( s% F/ I4 c
if (iedom)
5 o/ i5 ~! g% B% U3 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 `4 N# N1 x L
var actualwidth=''
5 [4 P3 x5 r- Cvar cross_marquee, ns_marquee
1 Q! L! h1 }6 p# j5 P8 D s2 }/ Q7 Y7 W0 f4 q1 T( q2 C, ]$ f
function populate(){: S, ]8 ?3 C- l7 g6 i7 J6 E, d
if (iedom){% V) O7 A1 j& M& e6 \. Y) q/ O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 O7 e! ] R" ^& \cross_marquee.style.left=marqueewidth+8
/ t+ b4 j6 ~# Y( fcross_marquee.innerHTML=marqueecontent' A* U6 t7 k+ z" j0 \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
C8 i6 d0 \& O0 d7 _0 t}8 c e+ v8 z2 n" x6 d
else if (document.layers){
5 @: C* I( w- j3 ~ns_marquee=document.ns_marquee.document.ns_marquee23 w0 R: V; V$ S# h5 s9 l: B
ns_marquee.left=marqueewidth+8
* F& ~$ V% V+ t& y s8 u$ ens_marquee.document.write(marqueecontent)7 y0 z; _6 P; ^) p! |5 p
ns_marquee.document.close()$ E6 s8 A: G' Y- r6 l& x7 c
actualwidth=ns_marquee.document.width
$ L9 ~! A% W3 V' a- J+ _3 R; @}
' Q/ D8 j& n% k! j+ `! Qlefttime=setInterval("scrollmarquee()",20)
/ B/ q3 w: k3 q+ v( g}
$ K# s' P9 l, awindow.onload=populate) H- t7 P( c9 K0 J5 e) h! O4 @( v
0 |1 c/ f; R) V: x U6 n' nfunction scrollmarquee(){
6 I3 f; f7 t7 z7 m' d6 U5 gif (iedom){( f9 c A. D7 J3 i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 Q3 L' q1 Y1 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 Y6 P2 @' X1 r* }2 D
else
: R. |' R; I% H- n" i4 ^cross_marquee.style.left=marqueewidth+8
% q. U0 l1 {% u
* s0 O a7 Y5 r) Q}
1 w) }3 [" W6 B- S2 T- Y, Gelse if (document.layers){% y4 Q5 m- K" n; b/ @
if (ns_marquee.left>(actualwidth*(-1)+8))
' ]2 n+ e) a. S& w; _ns_marquee.left-=copyspeed
' I" M) C' d2 T, [! aelse
: o" b j+ p |+ I/ Cns_marquee.left=marqueewidth+8$ f; Q5 R* @, B9 P( q
}
. V4 L O7 |/ g2 k: w}5 F: G1 N5 |# }, b
, v3 r% E \0 b4 e: C7 l- s* q1 C
if (iedom||document.layers){
7 N4 @9 E7 `+ T9 c m" l. J- ?with (document){
- P5 d* t0 [! f' p9 P5 l* S2 Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; o$ K2 O) ~4 nif (iedom){
# r9 r, J$ N' N( Y7 \" ~% ~% rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); w3 r/ a* Z; L5 Z& D4 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 N6 Z) A) Q3 x. h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 D! F4 F+ {4 T( E
write('</div>')8 k3 Q3 H% L" i9 A& Z9 \6 J% |
}
5 t" a) x- Y8 L% b$ o- L* |* w: Eelse if (document.layers){
5 o( P c3 U% cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* X7 u) C* g2 U7 Z1 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 c( e$ f1 V$ F4 g# o2 D
write('</ilayer>')) y1 Y4 ?1 e4 h* V1 e! i9 C$ g5 B
}3 [$ A. S& F4 q- w3 D
document.write('</td></table>')" N. [" b* J" {% N# }
}/ @ n" l4 ?) i9 j+ D5 y( P- l
}
8 v+ e+ G4 E) K/ D( {) [. P1 @</script> |
|