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

|
网页之跑马灯文字特效
//修改宽度
* D: w3 a) C& l: v4 gvar marqueewidth=300% [' J8 g3 d/ R% J
//高度
0 A' A v1 L% w0 j% y+ |, _1 Evar marqueeheight=25
J6 d( s' T# i- X% K( X& C//速度(1-10) d; F$ o% h! t3 _4 l2 f% W+ W
var marqueespeed=3
- v9 L0 i6 G3 \& P- S//背景颜色
, s$ G+ n/ d: z6 c6 c. Ovar marqueebgcolor="#FFFFFF"2 O: y c- b0 ^* P! a
//是否能暂停 (0=no. 1=yes)?
- R% z5 u7 Z8 Y8 [) p( pvar pauseit=1( @9 M7 _' v- K) W
( S1 f8 N0 T: C7 d# v3 O \//修改显示内容
: x c% b# o1 S5 J( p0 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ G; `; h0 z. d6 Y* H
& p! `# |& s2 }8 s1 ~9 |" I* s
7 G! \' g6 z; ~& Q! p" U+ k////下面不需改变//////////// B" q c# O# a: N5 I
9 k# Y$ J- X% u! c0 L F3 o/ H
var copyspeed=marqueespeed
& m* Z5 Q; U; W5 ?- R+ ?var pausespeed=(pauseit==0)? copyspeed: 0
7 I$ c0 B5 b# P8 j9 i3 y3 l) Cvar iedom=document.all||document.getElementById P, h8 {! z/ c# H+ j4 X9 y$ U
if (iedom)- {: Y% C9 e; A8 M' J( X+ {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ {- W- I' |) ]( P& Ivar actualwidth='': [8 a6 O; L% p2 M! X3 o z* y
var cross_marquee, ns_marquee1 M/ j3 D4 ]1 {! J
. z+ D# L4 T3 ? c: O: ufunction populate(){
1 N) V! y& \* l: v" s" y: Aif (iedom){ Z) u# C' ?% @6 H; _% o. {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 }: n. A' W5 m6 R% Y- across_marquee.style.left=marqueewidth+8
# u; s: N% g$ A8 Bcross_marquee.innerHTML=marqueecontent0 c8 j- b7 N8 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" N6 _) Q q1 S$ r8 W# E}
6 l( B- S+ d, _9 delse if (document.layers){& {1 d2 Q' X) e5 m0 h
ns_marquee=document.ns_marquee.document.ns_marquee2
5 R+ o* ~. q2 V! r) ins_marquee.left=marqueewidth+8
- j: v! r; d* D! H" L- Dns_marquee.document.write(marqueecontent)+ M' v$ c# z0 _8 `8 _
ns_marquee.document.close(); y$ K* u, ]+ x" R: Z
actualwidth=ns_marquee.document.width* {3 E, o# I7 I6 Y
}5 C" Y) Z) U j Z- J
lefttime=setInterval("scrollmarquee()",20)1 s' u8 e$ n1 K! d# O; l
}( r5 J" T, [1 Q( ]6 Q
window.onload=populate
( S: `: g6 K$ P+ p1 v+ u( |5 e% f" S0 w# Z) j! I2 o" l5 X
function scrollmarquee(){, F* y M; Z k
if (iedom){4 ?' M7 r! i3 a8 M' h7 C9 k* Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( I3 k6 r. v% T0 L/ ]2 j" ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, a" O3 T# r# j5 V# O& y# O; F
else5 r! y p$ u s* {4 t4 a( k
cross_marquee.style.left=marqueewidth+8, L+ }" [# j* E; ?; M
/ u& ]' Z$ f% t: y9 I7 u}
; A. v+ J6 E# ]6 P/ L& N" s% ielse if (document.layers){
, j: J4 m+ B, hif (ns_marquee.left>(actualwidth*(-1)+8))2 T8 j! f* Q5 Q2 X" m
ns_marquee.left-=copyspeed
; x, P7 Y) u3 K' \' ielse
5 P4 i8 D2 R) f$ T* P3 ens_marquee.left=marqueewidth+89 L& a1 |/ Z; } Q$ ~- |
}
/ ^- K3 t* l. w$ H# Y) D# G}
6 t: z& G, H; Y, c1 S
- O% G" E: t7 \" ]if (iedom||document.layers){
5 W+ ?) U9 e! T- gwith (document){- [% I L& T- Q; \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 Q' r% V8 A6 H% N# H9 S* ]7 U6 S
if (iedom){
% V- ^1 W1 P3 Z% M- swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 K3 R& V# Q! Y# c U7 Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- s% e% Z6 H$ O) e9 H1 T/ ]0 W; o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; o G0 R, r7 j5 {9 Ywrite('</div>')
1 }9 x2 ]2 U: e9 w, v- s}
* S5 w& v+ B, H. D5 B9 Telse if (document.layers){
# K& g! c. Q) b2 _- lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ }6 a7 J: y; K. i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* p: x1 }, G) j% f3 ?7 Hwrite('</ilayer>')
) h) D8 m3 l& o% N}$ B0 S+ q+ z4 F) S/ M1 o& \' K
document.write('</td></table>')
5 }7 o* K! P. }! O- v( |/ x}
: s/ r: v9 n5 Q4 ~1 j0 N}5 H4 `4 S& x, v$ E
</script> |
|