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

|
网页之跑马灯文字特效
//修改宽度2 t' n3 {: ^6 k
var marqueewidth=300
6 ]) z6 ?/ E0 T) `" ?( L//高度
2 M( p8 E: P; o, ]; Pvar marqueeheight=256 M; F* j" L* \* f0 a3 g! h
//速度(1-10)
% r( k$ u+ O6 s' V7 _var marqueespeed=34 c4 f8 ~9 i9 n4 S
//背景颜色
- H7 |8 G8 S0 `2 Gvar marqueebgcolor="#FFFFFF"
3 o+ ^, ?4 k N1 d//是否能暂停 (0=no. 1=yes)?3 |: D6 X" T: T3 m9 H- b
var pauseit=1
* ~7 c8 b' d5 l g0 u$ g8 L* s9 S/ `3 G
1 u$ C/ o/ C9 L0 T( Q//修改显示内容( d! P9 C6 ~, j3 t- m) h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( ^) [1 U# ^4 Z" q! R6 z
' ~( _* \0 _7 B" l& `2 A# g( n
4 m5 Y9 P# S7 g- G. C3 q////下面不需改变////////////* V3 C- V/ e$ x- Z9 W0 ^
/ n5 g) T# Q& g3 B# F9 O; V
var copyspeed=marqueespeed2 }4 z; `. K- a1 g
var pausespeed=(pauseit==0)? copyspeed: 0
9 y, K1 T9 n1 j5 v( h$ t" Evar iedom=document.all||document.getElementById2 w+ G2 r/ E0 ?! d
if (iedom)$ r0 V$ p* n5 f* K" F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" C T5 H# L, Q# E1 c9 C
var actualwidth=''( e6 }% t& ^+ \6 y7 n, X: Q
var cross_marquee, ns_marquee
x, K4 c9 t4 R& k! c S% A
+ ]! K9 P( q6 i; |" D( }function populate(){* F: I; ~ S4 W9 C0 q5 C: ~
if (iedom){; e2 U4 A: W9 x; L: P: Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) p# K7 m: B. e% }6 F# ?cross_marquee.style.left=marqueewidth+8- P' K3 q3 u3 g! H1 I
cross_marquee.innerHTML=marqueecontent
# f3 P. [" r+ h, O2 E5 X) ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# d) j, k2 r7 v& i2 Q/ k: g}
( c* r/ a3 e4 y9 c1 _else if (document.layers){
$ a( C' N5 t; G& ]! @9 O& yns_marquee=document.ns_marquee.document.ns_marquee2 Y2 @9 ^) N, R6 q
ns_marquee.left=marqueewidth+82 ]& \9 t# t- G5 I( }
ns_marquee.document.write(marqueecontent)
# [" W3 V5 P- Z* I1 g; ^2 I; |ns_marquee.document.close()( B6 B4 O S2 n! h3 m. U7 H
actualwidth=ns_marquee.document.width
3 N: m* {2 h% [1 w( f}
3 w' [! ~. v5 |lefttime=setInterval("scrollmarquee()",20)
, P S: c7 A& v: z7 E4 u* [ M}
/ ~9 N2 f! R: ?; Z1 c+ owindow.onload=populate
$ `+ V5 ^6 q" Q+ p4 W# U& m1 _
function scrollmarquee(){
" E3 A% i; I2 w2 j' x' Z. Aif (iedom){
% ?- K1 m0 n6 x8 i- q6 q2 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 _. W' J8 s6 p3 A# _0 N ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# [% R& ~; T4 ` _. F6 R# @else2 l6 c3 s; q7 R/ q- A$ v, F
cross_marquee.style.left=marqueewidth+8% y- @4 J; ~+ e5 k* C- B/ {. g
* D/ d- h+ i" h# d% U0 S}
/ @$ ` m# f4 zelse if (document.layers){
1 A. ?8 c; v3 N' ]- W/ h8 Mif (ns_marquee.left>(actualwidth*(-1)+8))
5 j' h( \7 k% W) j. ?+ e* lns_marquee.left-=copyspeed- \: X9 j6 |" p$ y0 H. p6 @& E. _
else9 Y1 E3 Y2 \8 r/ p8 J6 w m! M4 @4 M
ns_marquee.left=marqueewidth+8
6 L( o* g+ Y) @3 A4 @- g. j}$ _+ @. w0 d# |9 M2 Y7 u
}/ w+ e. U" w6 m
" a2 Q0 T0 L8 g* G2 f, B4 e- Jif (iedom||document.layers){& o- I; ~# f2 S% R7 y& B% [9 C
with (document){: ^ c+ a& R3 P5 _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) A1 ^( z# f" ]( \, K2 Oif (iedom){
; S3 E2 N/ T, u1 p( Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" @# O! X! R$ V; \4 J8 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); q4 t% e% m" B3 Y0 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 C }# _3 `- J- q) ?write('</div>')
* C* b4 C8 z o3 ~; S; S- _}- M% a4 P D' O) U6 H0 E# V
else if (document.layers){ Y+ ^1 O/ c, T% N2 ]6 B1 k, b* O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 P7 p$ I, P$ ~: Y Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 o c$ D8 `- L0 ]7 r
write('</ilayer>')6 Q' ]& f$ F2 Q0 z* `! O% ]1 ~
}6 [0 Z2 f9 [* \1 d W
document.write('</td></table>')' S1 f: k+ F. E% f# B v I
}
! m1 l2 K( @# ^9 j' C: i}
1 J7 p) B+ k1 d</script> |
|