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

|
网页之跑马灯文字特效
//修改宽度
z4 h/ }1 m |2 vvar marqueewidth=300; ~; W& o) B) {- R4 B' g
//高度4 `6 x' L7 d& \/ a
var marqueeheight=25
! [9 I3 D/ F" d& ]' K4 _//速度(1-10)8 Y3 E# Z' H( D b
var marqueespeed=3
X& L$ i# z3 y. H$ Y# K& q//背景颜色
' x6 { w/ `1 L1 Q* d+ hvar marqueebgcolor="#FFFFFF"9 Z. P' s- `4 N$ p, s2 b7 e
//是否能暂停 (0=no. 1=yes)?
3 f) S ~6 V- P4 Z( x Kvar pauseit=1
) M7 d% |5 n1 C9 V; |
& d4 t' d7 h* B! v% H; p' n0 o% A//修改显示内容
. @2 x [' ^ G q+ C/ Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
g& d0 x2 e; \" G' D2 L$ ~9 [ _. o% v# b; g
- x2 T0 @. I- U& \# S/ m3 P////下面不需改变////////////# N1 J3 I6 w7 s- g' R. f
' A; m% `$ I+ v: B
var copyspeed=marqueespeed
1 L" [$ b4 v8 N# P; ?% G& fvar pausespeed=(pauseit==0)? copyspeed: 0
( z$ G; @+ C) g) ]$ d ovar iedom=document.all||document.getElementById {' L0 x7 l4 e
if (iedom)% ~* F) I- G5 A; h/ W% z: G+ E" N& x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 Y5 P8 ~ b( G9 M" h+ z+ T
var actualwidth=''
7 X- E9 W- v1 A* Nvar cross_marquee, ns_marquee8 c% R) ~, m0 B/ u: b/ |8 f" ]
. d9 C. C; l# k( y. J! J6 K1 o) ]function populate(){
. L! ?$ W7 g; V' Sif (iedom){
4 p: r1 q8 H v! M/ H4 V1 ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- \: d& f+ X" L/ ?; O
cross_marquee.style.left=marqueewidth+8
) ~* ?( h) j$ S9 ^) P1 W/ \cross_marquee.innerHTML=marqueecontent
) Z! o: _. [0 N- Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! B+ u7 B- F6 w* M
}
& s/ Q* b! N8 z2 T( helse if (document.layers){
5 a- f/ O j' T+ `& d4 f! U! y, [ns_marquee=document.ns_marquee.document.ns_marquee2
9 g" D1 B$ N) | Ens_marquee.left=marqueewidth+8* o- E8 I {0 b
ns_marquee.document.write(marqueecontent)
, z$ ~% d; L( Y Z- j4 e4 vns_marquee.document.close()
5 e, B* R0 R: a4 e% Factualwidth=ns_marquee.document.width; s2 o7 R: j$ M. `% ?) w( B5 v& y
}! G- G3 D" p. m0 ]5 L s/ o
lefttime=setInterval("scrollmarquee()",20)
& T& r5 F# [( p+ E/ }}4 d4 s0 s8 t6 J9 l' `
window.onload=populate
/ j1 l) ]( g5 Z7 A, q# Y3 D! h" O9 }3 ~) ?1 z6 N6 a% s4 |4 V
function scrollmarquee(){
/ M& Y5 w' a- A& n. o [if (iedom){
, i j- G N( W% {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' @! }: I9 F: M! |% |8 N3 ~6 c- Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ \- E( ?8 g. D& d- X8 v5 D( W3 _
else+ G4 g/ G8 E2 L3 o7 n0 \, z( o2 n2 b
cross_marquee.style.left=marqueewidth+8! }* X; `% s' w9 ]: u9 M
. W/ F# u$ y( d: ?1 o' y( ~
}
; C& W, v# @: U: P- z" Z3 pelse if (document.layers){
) P: ?# @: ^- ?( B0 wif (ns_marquee.left>(actualwidth*(-1)+8))# G4 U' N" c! J( U
ns_marquee.left-=copyspeed" q9 h% p, ]6 o: A ^7 p
else
. I( o% m5 I9 d/ t9 wns_marquee.left=marqueewidth+82 K9 I. E- A3 v$ a/ x' }9 {. x
}, F7 E0 U2 X, ]- A
}
7 ^5 H6 x9 W/ S! {5 q* B' G4 s3 W: W: T0 n+ K5 |; t3 i
if (iedom||document.layers){) O0 W# F( K/ Q" E/ K# |. z. Y) {
with (document){
- X; w* ?- d, }$ n% idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) {/ _5 n8 f$ q
if (iedom){
# k @; o' Z7 t) Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" M5 t v p7 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ }' w) `' s& F ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 R1 ^" A8 q3 f, ^: T
write('</div>')
_$ Y5 }: b- E}
) l. u* S9 k% F7 B9 j7 v$ e2 Kelse if (document.layers){2 y0 [4 o, z6 l& I, R( o! Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* w0 s. M1 l. X9 d% M( g Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# f0 e0 I) @8 q& w* F9 G" z
write('</ilayer>')
8 w. R8 H! {. s+ |: g}- F R1 }% _/ f$ o
document.write('</td></table>')
0 c, v/ D t! x& B5 m}
' U/ K0 e4 w; ?}
9 C! C' n: [ ~$ r- x</script> |
|