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

|
网页之跑马灯文字特效
//修改宽度0 r" U+ L( n u" l$ r% ^: O$ R' q
var marqueewidth=300" @2 X& ^! i8 T( A7 I7 H
//高度
: B' Y; l+ l/ q0 b: a, P" |var marqueeheight=25- ?8 y7 D; V' E
//速度(1-10)
& ~& _4 |! ~5 U. Zvar marqueespeed=31 }( z+ e0 l( f/ W! T
//背景颜色
; S7 Y( J8 ^* Rvar marqueebgcolor="#FFFFFF"4 _& f- p/ V) u$ @
//是否能暂停 (0=no. 1=yes)?- L/ V) K- k+ U
var pauseit=1
$ Y) H9 `' `) N. i& T% F
4 T& a- h$ B# ^! R//修改显示内容
: f7 a. S$ |3 ~( {& @- t' fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( o. Q5 `4 ]* q5 y1 f
& |+ }. H- [% F
' E: v6 Z# d4 l& A////下面不需改变////////////! \3 v/ J; m# _0 L4 a2 H
& H9 n! S6 y8 P h$ u4 @6 Jvar copyspeed=marqueespeed/ e+ f9 ?0 w3 L; {
var pausespeed=(pauseit==0)? copyspeed: 00 l; \: E4 A8 y9 ~ r8 ~3 g: W, V
var iedom=document.all||document.getElementById# @6 s7 B$ Y9 p0 p. U
if (iedom)
6 C# O; b$ ?; n5 jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, @$ w7 T8 R: N0 s+ K/ _6 e& wvar actualwidth=''
3 `8 P* M+ |8 Z0 Q; Mvar cross_marquee, ns_marquee
3 t" E/ W. Z9 D$ O7 p9 v2 [7 @
' C. n t1 x* _6 U0 ifunction populate(){8 N; H m% R6 ^- J& h$ F7 l$ W
if (iedom){
* _. ^" x0 c0 A! {. \" ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ O* V- v6 g! H2 E m9 Zcross_marquee.style.left=marqueewidth+86 h9 p; t0 ~2 Q" Q" @5 t
cross_marquee.innerHTML=marqueecontent" ^6 [1 z5 e% ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, K! T3 r, S" Z}
( Y3 m# k2 x! F. j, ^- g9 m- a; telse if (document.layers){8 P3 M. C: Q* V* \0 J
ns_marquee=document.ns_marquee.document.ns_marquee2
% Y2 o; q% _6 Z6 r* Sns_marquee.left=marqueewidth+8
$ s( V8 Q5 r+ {! } x" T5 Q5 {ns_marquee.document.write(marqueecontent)
: U7 ^) `) \$ p, Fns_marquee.document.close()
( s$ q, X) [ t7 ?, ]9 k2 r1 u) Zactualwidth=ns_marquee.document.width
( \% A- V& q: z" r0 a% c- K}4 u+ R& r( R" |$ N8 A. t: u
lefttime=setInterval("scrollmarquee()",20), k1 c5 X6 w, V( E
}* z! c( R* T: g9 m! |6 L2 ?
window.onload=populate
* i5 R5 E9 U! i9 J+ D
6 |" B5 r1 t0 h, P6 P/ a+ _function scrollmarquee(){
" ?, Q$ O* r; H: A3 P0 r, uif (iedom){8 E) _7 u; \# V& G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* A5 W7 a5 P2 u. y$ [; f( k% ?+ b% }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* g8 O5 | B. d5 I, d o
else, ^7 P9 U# b) T- }' U: j
cross_marquee.style.left=marqueewidth+8
' A8 v$ n' j. Y* I, B! W- D* \! D+ U
1 D+ `6 u: {) B/ F+ J4 Z( q}
3 r' X* c6 T" \! k. lelse if (document.layers){
* ~6 U! j8 ~* V7 K0 o3 Cif (ns_marquee.left>(actualwidth*(-1)+8))3 ]3 ~% Z3 G; a, X8 J
ns_marquee.left-=copyspeed
; N. A3 w6 N# k+ z$ V& W' b0 N5 g% yelse
: I- M9 S+ s7 a' [# Ans_marquee.left=marqueewidth+8
: b' }1 Y$ O0 E7 e. |}
1 R+ S d y# R. p8 i" @2 b( @}
, g/ A: h2 S6 [. U& S
/ P+ s6 ~' Y6 P0 wif (iedom||document.layers){
4 {& X6 o/ w" C' c( \; ewith (document){
1 q5 u( L. z! s" \+ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* R. r0 _1 q- _- L- Q0 d( X
if (iedom){
' h& N" z9 O3 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); r, ~" q y4 e% u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 _) \( h1 }$ D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 z5 |% E! S3 S5 R! t6 L: k- |write('</div>')6 O, v7 L" s, h4 W
}
& f0 }6 I A3 y, u1 k( w2 ~else if (document.layers){
, _+ e5 E8 z' X+ q, xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" M1 C/ a9 _7 k3 P) Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 l! }( w; K( B. u$ M/ S3 Y+ y
write('</ilayer>')3 V5 Z3 n6 n. m
}
, m$ V4 O: D# l; `6 |6 }! mdocument.write('</td></table>')
' ~- T1 b3 l% F, p}
& I5 R2 }8 p2 x; k}
2 C3 b2 A1 F6 y, H</script> |
|