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

|
网页之跑马灯文字特效
//修改宽度
' |8 b( b& S, B0 {8 h+ yvar marqueewidth=300
0 D6 B- V: H, Q+ Q* J9 \6 Y8 q: F//高度
( x! k5 A7 ?, ?& tvar marqueeheight=25
4 Y3 n4 ^' Z l) w//速度(1-10)5 Q+ T4 S; i$ k" @# X- E( M
var marqueespeed=3
1 Z% G. A1 Q H: R//背景颜色
' ?: E2 i# F4 q$ c4 k" avar marqueebgcolor="#FFFFFF"# d5 ?3 V1 Q% E% y4 {/ G
//是否能暂停 (0=no. 1=yes)?; j) ~8 u: \' ]: r) C( U7 B+ I
var pauseit=1
; [( [1 z1 p" g4 i) k1 J+ }5 Q# p% |: s0 k; d3 c6 T* d: i$ o
//修改显示内容
. l$ {6 M: }% L" x0 [/ Y+ kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 S% ^3 U& M% p- D5 Q
& M7 d6 G5 ~: q2 G& z* n+ C& {7 L- Z( E1 F: [: L
////下面不需改变////////////$ X% Y& a2 y3 g6 K( k1 k9 U) y
% {! m( o* p0 @9 G( z# x) a& Ivar copyspeed=marqueespeed
/ I5 Q5 A( J( ?+ l2 Mvar pausespeed=(pauseit==0)? copyspeed: 0% o# ]' _6 P) `8 B0 z0 w
var iedom=document.all||document.getElementById
( M1 B* {6 G$ jif (iedom)
/ F/ A- _8 a0 H7 ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ k# o* ?, U$ Y0 T5 q7 E$ B Mvar actualwidth=''
* t$ v4 y. V- |+ L0 J* \) m) Ivar cross_marquee, ns_marquee. y T! [) R q; s
( ?6 |# `+ r- T& y, z( K
function populate(){5 P1 D$ w, B" Y8 g6 w$ X- T) C+ l5 u$ X
if (iedom){6 P! T L7 O: {# u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 { g2 x4 d2 @: u
cross_marquee.style.left=marqueewidth+82 s1 g1 e6 G/ J* D
cross_marquee.innerHTML=marqueecontent
7 {$ e6 X r. Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 e0 S2 C. N/ s& |8 A/ Q: J& R9 i}+ r1 r* x8 \- h2 C B
else if (document.layers){4 v/ Z2 |; d0 c# z8 Z
ns_marquee=document.ns_marquee.document.ns_marquee2
! R9 Z1 u, x3 d+ H, Hns_marquee.left=marqueewidth+83 `7 B' a+ D2 x
ns_marquee.document.write(marqueecontent)
: l4 K9 p% s% M( yns_marquee.document.close()6 N$ L+ K1 ]) w4 }. g1 F$ [
actualwidth=ns_marquee.document.width
\7 P9 z% j+ r2 T# Z5 X}
) `- a. l: Z% m7 {+ g) Y( zlefttime=setInterval("scrollmarquee()",20)8 w" R- e9 f: I8 K- j
}. s+ u9 ~; Q$ m @
window.onload=populate
( `& ]) Y8 k. ?9 I, ]5 P$ U ^: E5 R2 f6 H3 j( Q
function scrollmarquee(){
7 L* v# m* n4 {8 H$ v2 bif (iedom){
+ W5 [% r* |; D$ x8 I @' Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! M! g2 a- C0 j- Y. g ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 Z7 C6 g8 U! ?! ^$ Yelse
; u! W8 R% `$ `$ `cross_marquee.style.left=marqueewidth+8" h$ V( A ]& n/ n ~
, ^+ g" z ^, N* y# @/ J
}# u- D5 F4 u1 R, }7 k* Y
else if (document.layers){4 ~" M5 L! u* E& ^' m6 i$ @
if (ns_marquee.left>(actualwidth*(-1)+8))
" _5 i ?0 Y) w8 Vns_marquee.left-=copyspeed' Q* K) A4 v" g2 I5 r) x3 T
else: S3 ~2 t. U1 ]% X! }' X3 K* l; B$ B
ns_marquee.left=marqueewidth+87 E! Y. p; o. T7 H- `
}% N S5 e" T; j: b
}
! S+ i, `5 F% x8 b5 T
: l, l! _2 f5 K9 u5 a* rif (iedom||document.layers){
: _4 _3 g9 T0 X" B1 Uwith (document){$ v! H" E0 q; ]8 X/ f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ J, W, O, V* B5 r/ yif (iedom){
) X3 K1 q z7 \( Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 W6 j( O" _) M7 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 V$ H& y4 x/ M# ~" Y. l* @" Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# @! V( x0 _1 w8 R- gwrite('</div>')0 Z- z: ~+ W0 p4 @9 T9 m
}
/ t: T, n1 l# s+ telse if (document.layers){1 {5 n7 d1 g9 |, ], }$ ]* m% B2 P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' p( E5 \! K- t, [ Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 k: K) R! u' E1 z0 Swrite('</ilayer>')' `# ^6 H# |1 c0 l& K" @4 T1 U
} U: l, ?: E2 D) S- S
document.write('</td></table>')
" C- H" p* i1 b}
& X& F6 }) a7 p}
! C0 U) z( }0 a</script> |
|