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

|
网页之跑马灯文字特效
//修改宽度4 a5 G2 o! H* C) ?( e( ?; f
var marqueewidth=300$ h/ @3 L5 b: P# ]
//高度1 u* V6 m Y' |4 d9 f$ v3 F
var marqueeheight=25
( F, ]; B& Z9 t _8 o& E//速度(1-10)) @6 W. p) g2 T8 |* F
var marqueespeed=3
3 r6 q4 F1 M+ g//背景颜色
( W4 x) q2 K& zvar marqueebgcolor="#FFFFFF"
7 Q' ^* _; o" b" b* b" T//是否能暂停 (0=no. 1=yes)?* ^0 |% ?) T# D8 A8 V
var pauseit=1
8 B g! j0 T* j1 S
3 k. L" M% D. l$ I7 s! P% c//修改显示内容" L( k0 P& W7 H. j U1 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 Z: V. n+ x _) _& s. Z+ e1 {; [4 N, H, H* J8 y M7 _
( z! _- A3 [- `, t* `. }* I////下面不需改变////////////3 [, G* c( J& ?! m' n
4 g) I' s) [- t+ O! |* ]
var copyspeed=marqueespeed
* z2 W5 z$ n, T- Fvar pausespeed=(pauseit==0)? copyspeed: 0" v8 n8 X9 Z* h9 {% m! J
var iedom=document.all||document.getElementById1 }7 q8 h1 l% ~
if (iedom); _) o' A* X7 a& l$ A: P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. c4 l) l; y& `% Z( c ]( ~var actualwidth='') b7 _" b X2 h: {* h
var cross_marquee, ns_marquee' o% _2 k( c8 g/ s( i
& D" Q$ o; {3 j3 }/ w* c0 c/ Z/ d; Hfunction populate(){
/ m: b- a) A4 Z% f- h xif (iedom){
, M2 g, _- S0 Q, K& {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 i) e2 M- `) n/ M! _2 ]% kcross_marquee.style.left=marqueewidth+82 \, b/ P" `) z. m
cross_marquee.innerHTML=marqueecontent
0 `7 o' D! g y, Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 Y8 S! ]0 i( j3 ~0 W}! y- z- ^ ^7 R1 g4 S# v
else if (document.layers){7 | t, h/ L5 t' H8 X
ns_marquee=document.ns_marquee.document.ns_marquee2
8 W1 n5 n- o/ gns_marquee.left=marqueewidth+89 n% g: c* |+ X: H
ns_marquee.document.write(marqueecontent)
# X0 F1 F, i+ }3 v% fns_marquee.document.close()
3 P4 f$ |0 x) S/ [actualwidth=ns_marquee.document.width* E- R: M+ i& P. i) D' \( ~" D
}* ^/ d3 X% l6 t
lefttime=setInterval("scrollmarquee()",20)% a# }& b: Y9 r1 O; o
}5 N% V7 c6 l# J! w( ~
window.onload=populate
8 p. E8 n5 Q) \! k- l% C( v q- @! d1 V4 k+ Z [4 c
function scrollmarquee(){
1 Y- a3 g+ x$ Q9 c$ ]if (iedom){
7 i) a% p. R8 ~% T! iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 q/ r3 `- `# ^- X% D# `: Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 w+ Y$ d) ? i" t) h5 A# Kelse
' X, T; ]+ H; m. @3 d$ Fcross_marquee.style.left=marqueewidth+85 {3 y; C( Z5 [7 l
5 f7 k( E1 R* R B" ~1 t}" T* p9 }# g. e& ~
else if (document.layers){% Q% G, ^8 N( r
if (ns_marquee.left>(actualwidth*(-1)+8))% N# A6 z$ c/ F0 Q- g
ns_marquee.left-=copyspeed$ @: F8 X3 @3 |. N: N
else
! m) n6 ]" Z' _7 @ns_marquee.left=marqueewidth+8" h. ~3 S; W5 Y' v, ?- z3 c- y
}
! L& M* L) Q5 g" u+ Q: q4 K C}
5 Z- K& b% n8 n" y( ~
4 N! G! _( s6 Jif (iedom||document.layers){6 R) u0 L$ j9 X+ p7 _' {; ^
with (document){0 @7 u$ B; z7 m( |+ R7 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
`/ }- e; f1 G- @ xif (iedom){
9 ~. I; ]) D/ {( Z1 F* \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 x1 b! }" W5 _' Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( R1 q6 }' K: gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 a- B+ H9 y% @; T* ^) G& |. n( p
write('</div>')7 l* X$ _, a( G: l7 ^ }7 D
}# I, g& K" P5 T2 b. [: h
else if (document.layers){
2 r- _, L) {9 w8 B# l5 ^1 p* Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 m. {. K& L- q! wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ }" w. w# `( [6 U/ j! i3 J
write('</ilayer>'): H' |" e9 ~, w7 y' |( D& ~
}; ]. i$ f0 c0 D- a
document.write('</td></table>')5 k1 A& v* F9 b$ D0 F @
}
$ R( \% U2 e7 p; ^0 r- E( T4 {3 l2 h}
6 g% g- P( e; C/ t8 A</script> |
|