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

|
网页之跑马灯文字特效
//修改宽度
' T! P' P) e; h' s t! h! ovar marqueewidth=300
$ {* h: r0 @2 b) g//高度
& i! v$ E) A8 D6 g% S+ {; i9 U7 P3 W; ?var marqueeheight=25( y' B2 B0 d0 X3 ?+ x
//速度(1-10)
' @% I8 ]! W2 y3 |. P* zvar marqueespeed=3* L4 A+ x' L& q! V% S
//背景颜色 }# |" T5 [, C& X5 f- ?( P* h! N* u
var marqueebgcolor="#FFFFFF"
0 ^. G; _1 ], H. {# a9 `0 w$ x//是否能暂停 (0=no. 1=yes)?+ D% v% D& h* I" N8 j. F
var pauseit=1
7 b- Z6 ]+ t* L1 f0 ]) z) _* K/ S! M2 S% \
//修改显示内容
0 r* c* f Q$ O1 T4 wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% N& Z* T+ Y6 [/ Y3 K3 G' d, t* m. D& T. o( |
+ z1 X4 G t7 m; i4 P) B////下面不需改变////////////
( b' D0 e/ U% b' _+ K1 V
: G" R) M3 j$ p# E0 Pvar copyspeed=marqueespeed
4 N6 k7 Q# s" V, Evar pausespeed=(pauseit==0)? copyspeed: 0
! ^6 `0 ?: w' O' f# ^% p8 Qvar iedom=document.all||document.getElementById
) Z ^$ M2 _5 J C: x$ wif (iedom)& J- D6 i- _) H) ]1 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). U# b, N! J) a+ j
var actualwidth=''5 ]+ d# k8 j. C9 p" v6 Z
var cross_marquee, ns_marquee9 Z1 H+ l2 i' Z6 J6 o
n& Q! h5 ^' k6 @function populate(){
7 v& J: A( A% t, U% u# fif (iedom){, l' d; L, g/ \+ M r( K) m2 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# M$ q9 g( A1 E# N, h* \: K
cross_marquee.style.left=marqueewidth+8- S$ J& L+ X- o& F1 n7 F
cross_marquee.innerHTML=marqueecontent
6 K* L& b$ v2 `) b& h7 ?! g9 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 \- a4 g4 ?8 s7 @7 \}/ f j$ R7 V7 a7 w* M, W2 K
else if (document.layers){0 k+ a$ Q& `7 ^8 S
ns_marquee=document.ns_marquee.document.ns_marquee2
9 |* \, }: a4 z7 gns_marquee.left=marqueewidth+8
5 m, S7 o8 F7 kns_marquee.document.write(marqueecontent)
/ `' {# n, \1 ~1 `& q9 Wns_marquee.document.close()
, q3 b( Z s7 Y$ jactualwidth=ns_marquee.document.width
* e& a9 n! q6 p0 A. J( J}# I* b, J' i. F8 A( e; j
lefttime=setInterval("scrollmarquee()",20)
3 S9 ]5 A" u2 e- \) P f}* x3 {1 J( k% k( y* w1 j
window.onload=populate
' R- B+ N6 g6 {" e8 M* B' }2 P& z) m5 |4 s) N8 \4 b9 G* I
function scrollmarquee(){
; |& G; O# `& i+ _' h+ I3 Iif (iedom){
: u! F- v: H4 b" ]: I& Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& [* [; L% H e" G! }' ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ C9 ]6 Z8 H1 k3 c3 d! o. _else' ~: {/ g9 R% o7 S& u5 w3 w
cross_marquee.style.left=marqueewidth+8
# F* W( V4 |& E8 [# c' F8 |" g. I ]& i& H
}& z1 S8 l7 b, w) m+ |6 {
else if (document.layers){( E5 \; ?* S# Z
if (ns_marquee.left>(actualwidth*(-1)+8))* p6 Q. M! t& H m1 ?
ns_marquee.left-=copyspeed
1 r9 ^' K+ X8 Xelse
% t# F' i' U1 |* V1 N; Dns_marquee.left=marqueewidth+8
' }- B6 q8 g/ w1 K& i}
R B v. u) H. f}$ ~6 v2 ]2 H) p6 T6 w! F
# T' q% K& G- [1 Q* Kif (iedom||document.layers){
1 h5 t3 U5 N& J W8 V+ Cwith (document){
' A2 f, [9 Z! R" sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; O8 W% f \0 iif (iedom){& {2 C0 B2 f& W) B8 N1 I! B: R5 t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' ^% G" S8 i V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), o7 i1 N1 W* D; ]. K9 L, P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 C- C' x( y# I$ F4 C* J0 T7 b
write('</div>')4 E q1 V% ^5 i( j7 f$ L
}& N9 F+ |+ y) D& q, {/ O
else if (document.layers){
( s) `0 Q) ~9 X/ Z3 a1 \ Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* m/ w F) |, B$ d# Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 t8 e) V* ?# V5 A7 ~write('</ilayer>')
3 d& g% B. t- p* w7 Q}( H8 j; G) c2 @6 v
document.write('</td></table>')% V$ x* v. w3 e
}
; N: d7 x. t. f2 D) n; [- W& F2 A}
, V0 M" B# m3 s. @</script> |
|