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

|
网页之跑马灯文字特效
//修改宽度+ [5 @) r( O! R2 q: s
var marqueewidth=300
+ Z. _4 @$ J. w5 O4 p7 u- f6 A8 A//高度5 G; [/ J4 L* K9 h9 n
var marqueeheight=25
c/ h* Z+ d* i, N% y1 p+ f4 t//速度(1-10)7 T% n* T5 M' y* D& f, V9 O
var marqueespeed=3) E2 x! x$ m$ P- {& n
//背景颜色2 c! s t1 |5 B+ U3 k
var marqueebgcolor="#FFFFFF"
8 N$ O6 N2 v* r! Q! Y//是否能暂停 (0=no. 1=yes)?
; T* ?) d7 [6 m# lvar pauseit=12 z W% G L6 {' A1 d
; _% P# O3 W4 h% f8 b
//修改显示内容
- ?, s, {' |9 m5 I' Q+ _& X: G; Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 {7 M8 D2 A+ _1 k O4 P1 H" x# I5 [" h! G2 X% Q
! H3 N% A5 t. I |' A- n////下面不需改变////////////
( G6 M2 w8 h" }- D0 s
8 H! H4 G7 R) H% z2 ^var copyspeed=marqueespeed+ H/ b. e, g; L* }5 Y. u/ \
var pausespeed=(pauseit==0)? copyspeed: 0
5 n* G9 ~: \/ L! e* }var iedom=document.all||document.getElementById7 \. ?' Z- v# k3 h+ P/ ?- j5 F' w
if (iedom)
" b' ^4 |: b7 ]% G* I: \* Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 F4 Q: b% ^. h$ f3 i0 z" yvar actualwidth=''
* o6 ]9 A6 S+ M O8 j1 D* Z! Bvar cross_marquee, ns_marquee% {$ }) J0 I1 B, Y0 d: P: F, B
% ]9 s4 b4 b& |, `- W- A' l3 T
function populate(){
$ f$ z: Z, l) m- J' n4 C; ~if (iedom){% K# y7 v' [( m4 o$ X# w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. @8 z( `1 V% dcross_marquee.style.left=marqueewidth+8
& h2 \: C1 h+ a# across_marquee.innerHTML=marqueecontent3 ` o- C4 b- \7 m6 j7 j/ H1 k: P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ Y2 r* G" ~0 P0 z }+ E; X
}/ B6 R: }/ ?8 i* U; Y/ U0 T
else if (document.layers){
2 `# v( g5 B: e4 c" Z' L+ uns_marquee=document.ns_marquee.document.ns_marquee2
0 {$ H" u) {, ?ns_marquee.left=marqueewidth+85 u, ^# e7 Q+ P' i9 e) P
ns_marquee.document.write(marqueecontent)
% {$ ~$ x2 E: f6 v( Jns_marquee.document.close()
2 E2 g. G* C. }4 k" xactualwidth=ns_marquee.document.width
: y8 d/ ^' r7 Q/ C2 J F}% ]. F! v! b( p0 v5 D6 H% {5 w; |
lefttime=setInterval("scrollmarquee()",20)
2 U9 h* }+ _6 B}/ w& a. c; H3 [7 c
window.onload=populate2 e, s& z! D! A7 }3 F2 U% U1 D
& P/ t) H! W# a0 [1 X- Q
function scrollmarquee(){
+ E" b$ U/ u/ ?2 @* a. Kif (iedom){
3 Q) j0 d' Y+ ]2 nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 D; y- W) I ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# b' Q# @$ s/ K7 O" m
else& Z+ d; ^5 d9 k6 D- ]1 ]0 |; M
cross_marquee.style.left=marqueewidth+8
2 j7 L% f" G9 h+ s- b3 @, Q! Y7 ^! Z/ ? \8 b# p3 B; q
}( p8 `4 n4 ?) @3 X% j+ V5 O9 F3 ~
else if (document.layers){4 ]0 k5 _( c, Q* q$ T4 g
if (ns_marquee.left>(actualwidth*(-1)+8))
* S9 p+ O u) I+ x% Z& r. P8 v: _7 jns_marquee.left-=copyspeed
& s% d6 f' r6 J2 w! Kelse
* N, v3 L1 B; X7 n- H$ E" ~ns_marquee.left=marqueewidth+8
2 W2 i2 o% i3 |" r' G" N! l}+ t' q- l$ M1 }0 C+ j2 v7 a: S
}$ Y. P8 r$ t3 u& Y
, t/ f$ z, A! C
if (iedom||document.layers){/ l2 f1 D. k' B' ^9 a+ F c1 G! v
with (document){
/ V( S5 H; L# e# i! f1 d4 xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ }+ ?, [$ \! `3 k n, Iif (iedom){ V" z$ q. ?. k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" _3 A- D# h) ?, ~: p z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) ?8 L3 o$ [* r* |! A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& d% P) ?3 B$ j4 u' m+ @0 ^write('</div>')
( o$ L& R6 |: }6 ^2 o}
/ l/ ~3 Y% J! O( G# g3 Uelse if (document.layers){- T9 H, P1 d8 z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ I% y' X- F0 C( i/ V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& M8 }" q: U# I8 B
write('</ilayer>')! E" ]" N' d! o' I! }0 p
}
' _9 L) Q9 e# R3 }: idocument.write('</td></table>')
' K. {. } E" I/ S% B) E}. c9 K6 Y( C3 {( ~7 \* m$ w
}, k7 @) e8 x. P, W% V$ f
</script> |
|