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

|
网页之跑马灯文字特效
//修改宽度, Y7 K- X1 B$ _- |
var marqueewidth=300. D: K7 |/ N8 T: `- {+ J
//高度
0 B9 N1 v- U( F+ N# N' Yvar marqueeheight=25- R8 c6 ]3 T; Q+ V1 D+ `6 G X+ D
//速度(1-10)
* e9 a6 r: x Z5 q1 ]0 u/ Tvar marqueespeed=3( b5 o2 Y5 S9 Z7 D: U- o7 j1 ~
//背景颜色
U# f. |3 ^6 c5 ^% K8 rvar marqueebgcolor="#FFFFFF"4 m/ g! {. B$ c5 ?5 |; c
//是否能暂停 (0=no. 1=yes)?8 P& q8 z9 v3 Z" g% l
var pauseit=12 l$ ~! h1 g9 h( ^. h b
) |4 y L- O8 X4 S* _8 o' S: E//修改显示内容
5 I* c, q- s2 s% R6 D% ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 k) c% T) ^* z
4 [! e; T3 \+ U+ Z3 I
3 I7 L. V) p2 C- n+ _////下面不需改变////////////
: ^; [$ e) u; {: g% j; Y9 C k. n. F# q
var copyspeed=marqueespeed* e# T: p2 s# f) F9 B0 H9 T" l2 s
var pausespeed=(pauseit==0)? copyspeed: 0
- d$ l3 r9 [, O' `# k* ivar iedom=document.all||document.getElementById, e! o. S. ^3 k: }; }5 \/ c
if (iedom)
$ e' H# m/ f; Z1 n' A$ Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 [9 }, N9 U/ s8 a. l3 Nvar actualwidth=''- `- L4 C( M# j [% n! R( P
var cross_marquee, ns_marquee/ w1 U. Q0 t4 e* D. c
. D( J& z% S n# [3 l7 T9 J
function populate(){
9 G. g: k+ I3 `6 N! v9 a7 ` ?if (iedom){8 f* p6 L! K* h7 x' z; A9 B3 ]/ n8 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- L" @" B) ?- o B2 c zcross_marquee.style.left=marqueewidth+89 }0 C) ^/ C% E9 x/ B
cross_marquee.innerHTML=marqueecontent
+ Q: r6 u( X: O8 i ]2 Q) Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 V4 h9 G- p$ h/ E$ j: Y& p
}% u% ^8 Y- b4 T/ J9 g" f
else if (document.layers){
8 |- Z# {; a9 A. w1 Q, o6 v6 jns_marquee=document.ns_marquee.document.ns_marquee2
# [3 m u% w" u" b5 pns_marquee.left=marqueewidth+8
x& b7 _( N' T: qns_marquee.document.write(marqueecontent) o% A: \% p0 E. v8 v7 B
ns_marquee.document.close()
! b- A M3 R) S& Sactualwidth=ns_marquee.document.width U! ?9 P8 @, `! z# l; B' ]9 f" |4 p
}
' e" E4 U7 F3 J( ?! dlefttime=setInterval("scrollmarquee()",20)7 v& e0 m8 A8 U8 A) d. N( M! W
}' ^& b# U0 a0 c7 |; w0 K$ j9 k* K
window.onload=populate2 S" G4 G( Z( ^0 r0 }& p$ r3 |; z. u
* f" I0 |0 Q, L' q1 Q% H
function scrollmarquee(){0 \1 Q( u7 g! P& ~( z- g$ i
if (iedom){
5 ^0 q2 E& A7 u7 wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 p, H% B; J- `# ?0 a0 ~& n+ c: ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 O* |. f+ K/ R+ A! e
else
: P9 F% Y0 J' g( r/ Ocross_marquee.style.left=marqueewidth+8
# M- a1 F3 q) C: Q4 J- v1 o6 }% q% [6 }. K" c
}
0 ~ B0 W& h% F! `2 welse if (document.layers){- e' ~, J2 o* O
if (ns_marquee.left>(actualwidth*(-1)+8))! Y( C7 L& \( E) e1 a% r' c9 H
ns_marquee.left-=copyspeed
7 {" N8 o; n$ b( jelse4 w( {1 J, V$ A# V6 g
ns_marquee.left=marqueewidth+8; S5 h* ?) e& I" w( W4 t
}
! k3 ? n- L( ?. S}2 f; M0 j3 |8 _( I) z. n/ z
, s, b& D, e3 f$ O
if (iedom||document.layers){
" r9 Y1 |% I. n! uwith (document){
1 W8 l/ E7 T$ A& p! p' Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, Z+ o9 e% S8 D; iif (iedom){1 \/ S( O+ |' @/ [4 t- Y& @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. m9 j y' P3 p: R E# d; Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* ^1 |6 M3 v* ]+ F0 o) @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. [" g d/ u( p( U, y& D W0 Twrite('</div>')
; [' i: [; K& g. u0 @* B}
3 s% q$ P* l. k4 o6 velse if (document.layers){0 V9 \9 t$ w, U2 q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 r% L; ]. l/ L$ S$ Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). K" R/ {8 `) L* {6 H b7 x
write('</ilayer>')
0 a. w, c6 o# O c P3 a4 \}
! [1 e% W! g" n- pdocument.write('</td></table>')
+ R8 \. J6 ~" L7 r4 P}
2 V( m2 j- k4 y" t}# i/ J; \8 B2 F8 F
</script> |
|