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

|
网页之跑马灯文字特效
//修改宽度
& J# A5 ~& W. T: U( \var marqueewidth=300
% ^8 k! y8 A6 m//高度' q& v1 W- |) N2 t U* u
var marqueeheight=25
3 k: h# ^- V$ {% ?( x//速度(1-10)8 W2 ~ k( m$ V0 G
var marqueespeed=39 V; l! m7 k3 Q1 U3 ~
//背景颜色- P# i& l2 J6 o3 w5 s/ G
var marqueebgcolor="#FFFFFF"
0 \8 Q0 j0 K# ^8 _4 z5 k//是否能暂停 (0=no. 1=yes)?
" z' J Q6 P. ]var pauseit=11 P5 u, j2 N* K7 J6 v+ N
2 T' |( m8 Z7 W) a1 N
//修改显示内容
- E( F, ~0 ?# svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', T7 L3 d k6 t; G7 }
8 I: ]8 J/ c, X, `
& W+ ~! _4 t4 n9 F4 i////下面不需改变////////////
. d& O) N% E- h# ^6 x3 F- C" [) I; j! r# S4 E1 O' V
var copyspeed=marqueespeed
, A W& E8 }/ I! q. Y$ kvar pausespeed=(pauseit==0)? copyspeed: 0
! f' I0 u1 p0 C2 v3 D8 J3 ]( Rvar iedom=document.all||document.getElementById a) z% ]$ K9 D: i
if (iedom)" q' @! V5 c/ A9 Q/ _% J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): i+ t( A6 v( w9 _. {% K. o5 D
var actualwidth=''5 }, h! m% a( b% `$ J. l
var cross_marquee, ns_marquee+ M* v3 a! b% B g# j( h( Q
& l5 U( ?5 l: m" `; l
function populate(){0 O4 W* [6 m' c w9 w6 ?
if (iedom){2 O+ N. S+ H0 F4 Y3 W7 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( L- r9 K2 b& {& g% ccross_marquee.style.left=marqueewidth+8
, n- |. B T2 O8 v6 L6 zcross_marquee.innerHTML=marqueecontent
# _6 ?9 j5 A; o9 @6 e# Z. J" Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% p" _7 V- }9 D Z( e; I( ~}
' ~% a8 P ^. d$ Melse if (document.layers){
( d8 p! H- K" H! ]% h6 d9 y2 {2 Ins_marquee=document.ns_marquee.document.ns_marquee26 t) f: v7 {$ W/ E8 o/ Z$ U
ns_marquee.left=marqueewidth+8
9 h1 B" a6 z4 Bns_marquee.document.write(marqueecontent)
& ^; Q8 [/ {! g& B/ i l4 X4 xns_marquee.document.close() V1 K4 h; P5 g+ D
actualwidth=ns_marquee.document.width
- v0 @0 |$ V \6 ~2 r* b% s) I}
* V' f. k. @# d O& f# @lefttime=setInterval("scrollmarquee()",20)
+ A$ H% N# K" d! r+ ^- `; [}: q% C4 S6 {. ^5 \9 W6 [# E3 j
window.onload=populate# k9 |8 c6 \' Y
* E* k3 t' @" w' u2 t
function scrollmarquee(){
5 L+ V( `0 ^3 N* |% p1 t, Yif (iedom){
6 y [2 w/ E0 Z- w. W$ E, g" k Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 E1 _9 O! G; z3 X) ^. ]& @* qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# o( I C. L/ _- f" L& v
else O+ L& d/ H+ n5 ^
cross_marquee.style.left=marqueewidth+8$ U+ K, a: `- ^
. H9 I5 f4 p7 h8 u6 ]}+ |- e, {) d8 ` h. v
else if (document.layers){1 S o0 Q* [9 t' y! O
if (ns_marquee.left>(actualwidth*(-1)+8))
9 F( y# b' {2 z* Y: Pns_marquee.left-=copyspeed( {6 p' c7 j7 Z6 J; d0 E; o
else
, ~9 W1 B" J1 v! H/ Q9 ~ns_marquee.left=marqueewidth+8
' |5 \8 E9 v7 C# @# [0 s, P7 t3 ^! t2 d}+ M' }! t" d% A) `: u: }
}) ~. C; A! L( F. k* o
1 V8 |9 V+ R% T- l
if (iedom||document.layers){
) H7 ]6 f# d- I: W0 [: Cwith (document){; E& n3 d* B T2 D* D* O) b f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 I; x- g! `* x* F& Z
if (iedom){4 Z* ?- c% l( y [ Z' v6 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 g( Q- O5 K8 P: {. W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* p8 s; ~4 ~1 [, \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% U6 S8 Q2 Y" _' T
write('</div>')8 o0 d) v' D" A- D: k$ F- y; z( y
}
* A5 I9 Y7 M3 `0 t I0 A1 l( m% oelse if (document.layers){
" W( N$ y5 \6 O2 ^3 @+ cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 \- ~* `% [5 h3 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* ?3 p: q0 D0 R1 o
write('</ilayer>')! P- H) q; @/ g2 ~, n
}
; Z0 h$ S" b' r3 w; {. j3 vdocument.write('</td></table>')8 x k4 n) O. i1 Y W. V; o
}8 n4 V* L7 b( P9 P9 U! g- P, U: k
}
( z& y% I7 ?. D9 {$ Y- A# K</script> |
|