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

|
网页之跑马灯文字特效
//修改宽度4 X" A( G7 p4 [7 a, [' l3 b
var marqueewidth=300
: }. F. {' k+ |//高度8 U4 ]6 l9 y1 U- p; x! f6 N
var marqueeheight=251 I* [( T7 _ R# N' @& f
//速度(1-10). w" B7 R$ @( K; L. U4 y% E
var marqueespeed=33 ?8 B! ^( f( ?) `
//背景颜色
2 M+ Z M! C( Y. kvar marqueebgcolor="#FFFFFF") u2 P. M& V' W2 W$ e% ]# h+ K
//是否能暂停 (0=no. 1=yes)?
. ~; j/ N' I9 {3 c* i2 n, svar pauseit=1 \$ Y2 V# b' ]8 f y, V' t
% z I( [7 C1 B" l
//修改显示内容
3 ~, Y! Y5 a0 K3 p( n$ {" w" K( \) ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- M$ e" y; y" j& Q! }8 ^
" ?1 w6 C1 ^2 o6 R$ V
- P4 q4 B/ J, O6 I! b8 _9 n$ {////下面不需改变////////////% {8 ^! j# S+ ~8 k2 w. D0 s% ?" C
: J$ x+ M1 v. a2 A/ Y7 ^5 ?$ t
var copyspeed=marqueespeed
/ |, o% g4 x9 j5 l; Nvar pausespeed=(pauseit==0)? copyspeed: 07 q9 X* n; {" i) Y4 A$ ?# X* S
var iedom=document.all||document.getElementById
: H# u8 U/ k, y: Zif (iedom)) M# P; L5 o. L; J5 v8 m! J3 ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: _" j* d2 U' J# w: O& Jvar actualwidth=''
- F" j y, K) J0 @ R" mvar cross_marquee, ns_marquee
3 i7 ] \- x2 A# r1 T$ }
3 A4 Q. ]; f! Y, E% G) Zfunction populate(){
* W d ^$ ]" N" H; Wif (iedom){
G2 E w+ _8 w. t# v$ Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ K s: k2 b7 W% ~3 L9 y. [- g
cross_marquee.style.left=marqueewidth+8
6 C0 N* x( T& X1 q ?/ d6 Hcross_marquee.innerHTML=marqueecontent5 G# o0 ]. ~1 k3 f! Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 ]" e7 O1 I* B2 R7 Z}
. f/ O3 K: T7 oelse if (document.layers){( ?5 F' O; r: q+ r5 v9 ^
ns_marquee=document.ns_marquee.document.ns_marquee2
/ s# R% _' c; ~9 q, M+ Wns_marquee.left=marqueewidth+8. I. r, ?! j& @" h: ?$ R
ns_marquee.document.write(marqueecontent)7 g) L2 p1 c6 G( H: E
ns_marquee.document.close()
7 x/ V; H3 ^4 I8 ]4 ractualwidth=ns_marquee.document.width' P% p! l# D- `" T5 S' ~# D
}% c2 V: C# y- w/ k/ L
lefttime=setInterval("scrollmarquee()",20)
e+ z, J# H% [}- X! W; }) h K$ ]6 h; {+ ]( h
window.onload=populate4 e( Z' v4 W. U& |/ J' |0 g. x# }
# b0 ^9 C) U8 U! M' P: L
function scrollmarquee(){
Y |9 ?2 J A* ^) t( cif (iedom){9 T- L4 M# W3 w) V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 T" }4 T6 r* g, q6 x0 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 H. Q, h7 ~/ Telse$ | d! p O6 ` |( S
cross_marquee.style.left=marqueewidth+8
+ M" Y. J# _) H3 o4 i) k
1 S* L0 r, v6 m}
1 h+ y& k8 ~3 r& S, h& E5 Delse if (document.layers){& O% X( m3 J: H* z% o( I6 Z
if (ns_marquee.left>(actualwidth*(-1)+8))+ A' N( ~ u& f r9 H! R5 S1 H
ns_marquee.left-=copyspeed q# n* V+ e; U3 m5 Q
else; Y" K8 R9 ?! X
ns_marquee.left=marqueewidth+8
" H2 b3 T, t7 U" G+ q2 v5 A4 i, L}) o6 ~4 c" Z) o
}8 u) Y& Z) d) N. _ e
9 I2 L. O% X8 M( C2 k3 O( Q
if (iedom||document.layers){. K' U% N# C6 g# v' I
with (document){$ u: ]0 G1 {" ?8 F: f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# X n7 X) t$ f6 s7 H' a4 n' \: {if (iedom){0 V( {* z6 v8 D+ ?7 n( H/ k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 f; R8 m# d) |+ t' Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% p0 }; {- J" Q, Y8 k, Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 g, d/ z8 @* ?% g1 kwrite('</div>')
; {/ G- I7 X' l$ n2 _4 j* e: r}2 }1 ?+ \& j9 ~7 o5 a" R
else if (document.layers){
. {2 s6 S8 ?- g+ Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 w: O) }- y8 v# U- B# C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 e5 K- I6 H5 `4 t7 kwrite('</ilayer>')
, D( q& V7 g. a u}9 _1 u. o9 @4 I. J7 A9 `
document.write('</td></table>')
6 E2 u p# ^! Z/ F}
1 j8 r! Q% b2 B- m" }}
$ x( ]0 Q7 O& |. b q/ f</script> |
|