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

|
网页之跑马灯文字特效
//修改宽度
9 s& U$ ~& ~: R. W# ?( Yvar marqueewidth=300
( ]( j+ H+ W' D- B//高度: _) S) S5 m9 _% ?, z
var marqueeheight=25
: ^$ F" z% R7 Q* U//速度(1-10)* y( l: R$ k* b3 m3 }3 n8 M
var marqueespeed=3, ~* Q5 j9 D8 |1 b4 T$ W* ~7 a
//背景颜色/ o/ G {# M. G) H
var marqueebgcolor="#FFFFFF"/ I' m4 U. i/ N
//是否能暂停 (0=no. 1=yes)?* q1 U+ _) P) r% j+ ^6 a
var pauseit=1
7 _) I9 V0 w. a7 T( r+ y( r* E3 R6 q) [ }* e7 L
//修改显示内容- Y c3 \+ y$ _; Z! ?- I1 u1 B8 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 i' b( b/ A/ v8 l2 N! a& b
: q c- u1 @5 k7 F. S& f
" O1 r0 `' ?- O6 g- h5 l) x1 B
////下面不需改变////////////
4 h. P- ?2 S3 p
8 a9 t- G# \ H7 Lvar copyspeed=marqueespeed1 Y/ P1 d' x7 u( P
var pausespeed=(pauseit==0)? copyspeed: 0
- V' X7 z# o& v: {$ B( U0 u( X& cvar iedom=document.all||document.getElementById
, M- y/ r+ O; j) a4 g& kif (iedom)+ R' R- @' C7 _4 s; ~9 F" m: G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 V% Z9 w% ?) }# d6 _2 E
var actualwidth=''7 \5 ~' z3 e Y* t' }! P6 P
var cross_marquee, ns_marquee
/ `: n! W `( s" J. R1 O
4 k) _% y, H7 L2 n' _2 Zfunction populate(){- _' ^& {, ^" u$ d% [, N. c* }6 e
if (iedom){
1 w' n9 z; k3 \" s# Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* U6 t, I: u7 V+ X5 ` r8 a5 {cross_marquee.style.left=marqueewidth+8
5 M" x/ [* m: u! Wcross_marquee.innerHTML=marqueecontent
/ N a+ S; H- k* L* S! h. n* {3 F6 Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 C+ H# K3 J, P0 X" ~}3 U" ], h1 Q" Q* B% @
else if (document.layers){
# U7 R: D; ?8 [ _0 s; h+ T% e3 Hns_marquee=document.ns_marquee.document.ns_marquee21 Z0 {1 x% o* ~$ F. w5 X
ns_marquee.left=marqueewidth+8& l3 _6 T; v3 f: t
ns_marquee.document.write(marqueecontent)
; R8 v1 v8 y9 V* s9 sns_marquee.document.close()) V: l2 t# l( o }, L. Q% }
actualwidth=ns_marquee.document.width" J$ I& h! n1 z& g) V) y4 l5 T3 w
}
9 w% o0 }' o1 p J+ g! X7 c/ mlefttime=setInterval("scrollmarquee()",20)
7 W& S( G$ z, |6 F* ~}
* M* A6 F( }5 v. t kwindow.onload=populate6 s& g0 ~' q3 @
2 @) D4 B( _! vfunction scrollmarquee(){: p" |) _3 B: P: d% ^
if (iedom){
$ J0 Q) D. }9 I* }2 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 F( d% F% h! L. U, c8 o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* s$ O1 E1 j. S
else
) e: S% p, t' _& @9 O* ^+ ?/ F* Vcross_marquee.style.left=marqueewidth+8) s$ o4 [, n% {" c! H! F' f0 w* p1 p
$ t" s5 r. i) H h# X! w}0 k! k% E% f9 z8 u- a
else if (document.layers){
Z0 C6 [, e* N7 [1 cif (ns_marquee.left>(actualwidth*(-1)+8))9 t; j% [) ?$ D+ J3 ]0 `5 G
ns_marquee.left-=copyspeed. c5 K9 |" d/ V2 s4 B4 ~ i
else
3 c8 W ^1 L3 J9 q* b9 Mns_marquee.left=marqueewidth+87 S5 q9 Q, K- ~- w0 E( ^
}! g5 q" T4 j; E+ U
}
0 J9 C, q, p. q( c& i, E9 P$ X) q0 c7 s6 I- y) Q$ Y
if (iedom||document.layers){
8 U9 {6 I6 D1 G% B. \with (document){
+ Q/ d; Z( ?, H( z N, }$ ~2 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ]' I( t- d' B3 \5 q' k7 y' ]
if (iedom){
) y) `& d+ \1 r8 {; A& Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 X+ [/ M1 X+ V/ q+ ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); F Q3 P# G% u+ r/ W. E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) [0 ~, {9 j4 R5 owrite('</div>'): L3 w$ i' g4 [$ C2 h
}
- q3 K6 H" G9 a1 i. Aelse if (document.layers){& P9 \* I; S* @. r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 \4 w; F+ l8 S) {( s' w; lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' V9 @4 x* A: F- x: y
write('</ilayer>')
1 r% s; `( K$ h- F; l- L5 e}7 @6 I, ?0 t& N7 J4 ? H
document.write('</td></table>')
' H3 A9 e5 n4 Y" O% y}' P0 i4 ^3 ]) [. u- y, o z
}
9 G! E, ]: M+ E; A! c</script> |
|