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

|
网页之跑马灯文字特效
//修改宽度5 I. S: A6 M* r- C! P7 l& G
var marqueewidth=300' g+ X8 e% f. f# R# }' K. C
//高度
. V6 N) a4 ?1 ~, h" E$ } I1 G) mvar marqueeheight=25
$ U& U+ W, W }2 u) S/ X F" G//速度(1-10)
7 v2 z5 X& m* n2 wvar marqueespeed=3
# y/ w$ @& E! N4 e, O, K. I2 T//背景颜色 I4 J6 J4 H( p, V7 D( }3 Y+ j" R
var marqueebgcolor="#FFFFFF"
. D5 P5 \% h; P7 \/ ?; P& N//是否能暂停 (0=no. 1=yes)?
A) \3 `# Q3 Z" e$ S2 mvar pauseit=1; k. q& D' Q1 e g: w
5 i, Z% V9 P$ D! s8 {
//修改显示内容
" D l' g0 F% c, b7 z& G, Q% C# }8 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
s2 T+ O9 x6 V+ T$ ?" a) }$ \6 s I( m5 d/ t/ k
8 Q9 B+ S2 W! x4 [- ^7 ^////下面不需改变////////////9 E% I9 Z" e3 ?8 }5 X
4 d [! d: f8 X/ R) jvar copyspeed=marqueespeed
, w' ?' s" F0 U' S0 nvar pausespeed=(pauseit==0)? copyspeed: 0# _* A7 D- \" U7 B: n. H3 I
var iedom=document.all||document.getElementById5 s6 [; t+ L' E4 _/ z
if (iedom)
0 Y o8 T- v# L) @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Z8 |. Z" a) |0 u7 T2 pvar actualwidth=''
( \: c y) b/ ?! A+ mvar cross_marquee, ns_marquee
, ?: M0 R6 b2 z2 E* z. @1 x- E
function populate(){
9 H4 l# Y% M3 F$ l- ~if (iedom){
% d# j9 a r; Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* N, O# v: Z& O. Z$ M% u( jcross_marquee.style.left=marqueewidth+8* q c4 {1 ~$ w1 x9 _6 P, _1 B
cross_marquee.innerHTML=marqueecontent
) k+ |4 _1 s6 _8 x3 O% E! Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- N N3 Z3 m% H% @4 l
}
! s- D1 x7 n0 x" helse if (document.layers){
! Q8 F6 X7 l1 M$ F" v* Ins_marquee=document.ns_marquee.document.ns_marquee2
. R+ R+ {6 m* H" @; b$ Kns_marquee.left=marqueewidth+8- t+ G) `* q) t& \) P7 q
ns_marquee.document.write(marqueecontent)) A% l$ n, F5 J
ns_marquee.document.close()
* \- k: ]1 x5 kactualwidth=ns_marquee.document.width
% ~8 k" y: G; E}3 Y5 r/ W$ ?+ n2 c4 h8 n
lefttime=setInterval("scrollmarquee()",20)/ {! H0 R/ c) v( T) t. h
}
7 W6 g3 r, L0 ^1 x8 }window.onload=populate
7 C* s3 L t3 k( R* Y* w" G0 H) X, Y! F8 D4 C
function scrollmarquee(){
$ M2 D$ k# K# W9 n0 t$ S% {if (iedom){+ d5 v, ?" w! ?' `8 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 ~, n( X: O3 J. V3 W# R- c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: @5 C! S8 p! T. f% A; x9 G
else% r( \1 H! k; V; I. `0 h* [- P
cross_marquee.style.left=marqueewidth+8+ B1 A4 O+ v3 l3 U1 a7 s: ]
9 U: b G$ R: v5 g- W, Y4 L6 v: z
}
6 p* N4 C$ J+ r3 V- felse if (document.layers){
7 ~8 C* _( Y% C' zif (ns_marquee.left>(actualwidth*(-1)+8))
( H& m' T" c) |& d; x1 Jns_marquee.left-=copyspeed4 J. I4 ], j; b! Z
else
/ m X9 `' \! e5 x$ F" tns_marquee.left=marqueewidth+82 T$ x7 t# J) K! ^1 F9 p! r
}1 {1 g7 j7 i0 d( I4 s3 h
}
4 ^0 `' s4 g. X* x! Z1 P/ H" n7 C+ t* _7 g
if (iedom||document.layers){) o$ v& t% C5 p. ?' y& W
with (document){* {, ]! k" n" |) I* j7 B* J6 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. D2 g0 l* H' R9 Yif (iedom){7 R$ |! e$ r; j( {' ~. J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& W; r( i* J: L iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 U% x- W3 ^: a# ` O/ A$ ^0 y* e: ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% a" B# I. t( t& f( W
write('</div>')% u/ x" m: i2 S& W5 l! L: i
}
5 e$ r4 o% f5 ~, w7 i2 y3 G1 d7 F+ h. melse if (document.layers){
|' W# P- u- K; T( ~9 L! S" ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* Y3 {7 q4 R- X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- A, H+ j t* Y
write('</ilayer>')
" m+ y0 m/ c3 P2 R}4 F+ R, e V, N. L
document.write('</td></table>')
3 `- h3 p4 D3 K" N: k; E}6 B4 U2 E; v% z8 D' `
}- c* K! G# R: ^- f& z4 u
</script> |
|