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

|
网页之跑马灯文字特效
//修改宽度- X# M; {9 `- t+ N8 x
var marqueewidth=300
% ~2 |) `1 r5 A$ k//高度
2 h: F) L3 \) C' Evar marqueeheight=25
3 c | O; j# j3 t, b' h//速度(1-10)
: W* {& u! j3 b7 T- ~var marqueespeed=3* Z n, Y; R# E6 `! y# B
//背景颜色
8 o% h4 V# h* Z8 |$ [, lvar marqueebgcolor="#FFFFFF"6 E$ _ w4 ]: J8 c
//是否能暂停 (0=no. 1=yes)?6 w+ X+ C( j" G
var pauseit=15 l7 }: y6 {& X# @( i; H( ]' {
2 _0 T& W% p; F4 F [6 E
//修改显示内容, ?- z* A6 j- `) t# w) o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 f+ H) _. b4 i: P9 Z% g% w; G, j- P. m4 q' D
5 r) A0 b' Z) q+ ?7 J
////下面不需改变////////////
3 v: {. H3 \4 d3 l
7 `% I; c; d; a' x: K0 tvar copyspeed=marqueespeed* [* Q& G R! p* w' D
var pausespeed=(pauseit==0)? copyspeed: 0 R3 E' Z0 G. {8 a' f$ q. z
var iedom=document.all||document.getElementById7 T0 e. j* E+ {1 N( c( @
if (iedom)4 T# u$ G" N2 v4 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 V1 Y) f0 p" _2 {, M; Pvar actualwidth=''
2 J$ F( R! s. x4 P P( R p. Hvar cross_marquee, ns_marquee- U2 D3 x0 n, @6 Q" U! p
6 @% h- {; Y. o7 [+ e1 B. _
function populate(){3 |% x: N a( x; O+ ]( x
if (iedom){
r! `0 b% D: G( wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! {/ C! J- x1 R% F1 {5 u" ccross_marquee.style.left=marqueewidth+8& H6 b% J4 [1 f
cross_marquee.innerHTML=marqueecontent8 X* d. [3 a( @- _7 h R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* Z/ @; U1 T+ v# j$ ]; k
}: X. C% e7 H# q# W$ {
else if (document.layers){& |7 d2 R8 J' y0 R
ns_marquee=document.ns_marquee.document.ns_marquee2# v; R$ G3 _7 x$ j( m0 c5 t' r% Z
ns_marquee.left=marqueewidth+8, B h& B" U5 Y8 ` O
ns_marquee.document.write(marqueecontent)
( W% x# V4 x8 h8 G, X- q" Z7 lns_marquee.document.close()
- V; g( B8 Q. E# n \actualwidth=ns_marquee.document.width$ P6 w0 p; X( e
}6 Z" `8 Q9 C; T2 ^( q
lefttime=setInterval("scrollmarquee()",20)
4 g9 V# g, z4 n# J' p: Y+ j}
k5 z& {6 z8 J7 f4 _! fwindow.onload=populate
5 f9 v" K) n& v* t# v# F- S7 X4 O( d- B0 P) L+ ~
function scrollmarquee(){
. f) {2 P8 \% j" J" o) k6 {2 X. ~if (iedom){
, \- k6 ]. B5 Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* q( |1 ^# G/ o( ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 Q% `1 l- Z3 f4 n( t! {( u
else
) O) Z, d# E7 kcross_marquee.style.left=marqueewidth+8, Q7 W/ \5 f( O
; ?2 V4 X$ M& _+ n4 P* \
}
, F L4 `* g) Eelse if (document.layers){7 ~6 f7 g' w! @; ]* c9 ~; `- J9 b
if (ns_marquee.left>(actualwidth*(-1)+8))
# g0 h' q$ a. R! e$ Ans_marquee.left-=copyspeed# I* ?3 T3 _8 ~: c2 J
else1 C7 h3 w1 w* A/ U. s+ @
ns_marquee.left=marqueewidth+8/ g& A/ Z! {# Q7 h# I" @1 O
}
1 o7 a/ [4 c+ e( ^8 K0 P4 z}
1 @ b8 T6 ^" _3 E% z) {: F# `% x0 n, @1 q" y/ [& ^4 P
if (iedom||document.layers){5 q1 O7 r- A7 }/ F
with (document){" e% g3 x/ K7 a2 l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 s3 j. Y2 N" ]if (iedom){# c$ R |: Q) U5 F, q3 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 I+ w" P+ Z) L; z; l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( y) \' `( z! ?: h Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! ~) M# j; w7 g ]6 R! z" Wwrite('</div>')
) r; y$ k5 i9 Q3 O1 @5 U}
% s: @+ u( Y. t9 K# e2 g3 Melse if (document.layers){% z' C$ B0 {7 s9 ^" p' [9 E5 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 h+ D% Z' K4 Z& c/ n( g# S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); D7 I& s; M7 K: {
write('</ilayer>')( r) y& {9 w' y; B4 r
}
1 {7 Y8 a: R. p1 Rdocument.write('</td></table>')
8 W- |. ^/ t8 D+ G# K% K: v}/ l/ r: X+ @6 T9 n; d' F) I- J3 Y
}
2 {) n9 M) g& U2 O</script> |
|