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

|
网页之跑马灯文字特效
//修改宽度/ m! I! z0 D% v4 {
var marqueewidth=300
! c% a+ p4 j2 s T3 X# @//高度
: @6 I5 d: y# o/ k2 q- Bvar marqueeheight=256 Y+ Y7 _/ g- Q9 o) m3 v
//速度(1-10)
4 \: o+ x$ r3 T+ \% m3 l# u. R$ yvar marqueespeed=3
$ n7 N H2 \+ e4 X. J4 Z# k//背景颜色$ k% x9 j6 a9 M# n
var marqueebgcolor="#FFFFFF", X4 P; ]8 d8 G6 j9 z6 P
//是否能暂停 (0=no. 1=yes)?4 H" F* S- |. `! p
var pauseit=1
9 z& x1 X) c* `7 A5 |9 H: m. j0 \ H
//修改显示内容$ O; `/ a8 _, U* q. T+ O% L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. u7 N5 S! U- ~* R5 u; G
* ?& V; l6 R' r8 m6 M9 d. c, ^4 h( e9 z: z0 `
////下面不需改变////////////! Z Z: ^) {( f8 P5 I1 L3 `. A+ P0 d
7 X7 Z `( f, W2 n! W. g$ L
var copyspeed=marqueespeed
$ P8 ]: B. q( a' \+ v) k4 s: xvar pausespeed=(pauseit==0)? copyspeed: 0
4 E$ b% w, ?5 z2 Q+ B6 `; |8 [var iedom=document.all||document.getElementById6 _# M- A9 e! L4 J& H* S ]
if (iedom)
5 A6 I- i; m" Q: X! F3 E' k" zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): `* `5 }- M0 `1 d$ G
var actualwidth=''% c' ~. A9 t0 c; g7 @
var cross_marquee, ns_marquee
; ?* B" r4 I9 V, p+ I, a! l3 |6 D7 {6 `9 K4 C) q
function populate(){6 |/ a ]0 y# O+ `$ P( s
if (iedom){$ |, B, @" e" x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 c* _6 k' g/ A V( o3 I4 W
cross_marquee.style.left=marqueewidth+8) h4 W" q' A( @( ~ g% q+ a
cross_marquee.innerHTML=marqueecontent
( T1 _1 g% V9 W. K% Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, A# I% A; _+ c( F# ~
}- R; o) _6 J, z
else if (document.layers){
% B' S1 A" w$ Dns_marquee=document.ns_marquee.document.ns_marquee2
; I& c* V6 O" I+ { b$ K5 Kns_marquee.left=marqueewidth+8! E# o; l: W- T5 [2 d; D8 J# r
ns_marquee.document.write(marqueecontent)
/ l) L) f$ p8 ]7 @# c& ]ns_marquee.document.close()+ O1 i6 ]! z/ O
actualwidth=ns_marquee.document.width
* K3 h) h0 r5 Q: h# a! x6 ]# T}
* K2 l: E* D5 O7 @" llefttime=setInterval("scrollmarquee()",20)& p* @& z/ L8 m1 y) o
}/ g. A6 a2 O/ F
window.onload=populate
9 [: a# E; d9 M& \% J
# T; y, j. G& Ifunction scrollmarquee(){+ d+ |0 P c- q6 O3 R4 S: P- m
if (iedom){# R9 @7 c; e `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! n# ~' A, W5 R; [; b5 N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- r/ {( R, L6 D @. f# R3 v1 h
else5 P8 l; ^ R4 T; P( g3 ]7 j
cross_marquee.style.left=marqueewidth+82 I/ d$ Q" {5 k* D) k
* I4 v, ?; U4 t$ W2 Y) I* D}
`) @) C: c/ F' N. t* b) Welse if (document.layers){$ u/ C0 f# \ b5 e) G" D3 ^
if (ns_marquee.left>(actualwidth*(-1)+8))" {8 W" v5 @2 `. M1 i
ns_marquee.left-=copyspeed
; W: v ?7 O& S" K8 K; ?# Lelse
8 j1 W7 s7 S( \% _; Jns_marquee.left=marqueewidth+8; ~% z @, G% Y- `8 H6 T
}
7 R2 Y- V/ _5 x/ G7 x: a& U5 _* n, ^}0 L' \- s( M4 J' M. I @7 d
) G( Y' c# k+ {6 n
if (iedom||document.layers){; ?/ M3 c$ b) q
with (document){& p4 L6 r4 `) C# T# L9 D6 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' j! c7 ^" d" A/ V" g: e7 N
if (iedom){! l5 N8 \" l7 |3 g5 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! t$ m. ?: r/ V5 }; d: h$ |3 U( q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 P+ C/ z1 y& i6 w* B Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 ^3 J4 L w. i/ v2 K
write('</div>')" A* u4 x4 m% X
}3 F- y- x* m8 q, S7 c
else if (document.layers){
. o2 j0 m$ b X; I8 t0 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): I E [( c' N0 X8 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( c3 J5 M; O2 T4 c1 }6 Y7 G
write('</ilayer>')6 B# b1 u/ S- w* p
}/ |' {: ^: W6 m' P
document.write('</td></table>')
- ]$ n/ O9 ^/ a& b3 N. ^: c& t}
0 P) g; @' _. K2 D4 F}
]) [+ E8 s! U: O, i</script> |
|