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

|
网页之跑马灯文字特效
//修改宽度
5 T2 U+ l! q. s7 ^9 [var marqueewidth=300
8 d7 m. L& o0 S& Q1 R( Q; Z. ?//高度! h1 K% O1 Y7 p6 A
var marqueeheight=25
K: }. |4 _1 K5 N' k; T5 g% X//速度(1-10)
! ?+ G5 y, S2 D/ b# I ? V3 m$ vvar marqueespeed=36 M7 D' w& ~/ D9 m7 I
//背景颜色/ B$ F! k. C) \# u6 B5 X& Y
var marqueebgcolor="#FFFFFF"
6 Y# a2 V6 w6 j0 T9 S//是否能暂停 (0=no. 1=yes)?
2 A$ }8 l: D* W+ v1 c1 G% J% Yvar pauseit=1" }/ x4 g6 c) a" D
5 N7 |3 t6 |7 t0 d! w//修改显示内容( q( S" ?1 A3 J" ?+ B4 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 E0 t$ k% k9 Q
1 a5 S+ U( K( {0 ~& I# I: } `
% b$ f# C! |' N) ~2 m5 p////下面不需改变////////////3 o2 \, K1 D7 x4 o
6 ? B& a5 B0 j% E0 y% f( Y
var copyspeed=marqueespeed! Q, m0 [# [( E) l3 k4 N4 w" k6 K
var pausespeed=(pauseit==0)? copyspeed: 0
4 a! O V) `# V- O8 a3 [) nvar iedom=document.all||document.getElementById0 x, `8 y6 R4 i0 f, O8 l8 g
if (iedom)
* g, F" v$ N% m8 M6 \; {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 ]4 e. u7 D" A* ^% X8 Y7 L' `
var actualwidth=''
* U3 w; C' F3 W$ T" |var cross_marquee, ns_marquee
& K/ ~- S! X) f" [
7 n q7 i9 K0 m0 L. y. ], pfunction populate(){
1 F5 k1 |0 @6 N6 J) I; Eif (iedom){
: ?5 Z5 O; ~2 }- l& V. ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# @. h4 {" }9 ocross_marquee.style.left=marqueewidth+8! K5 b, A7 Q4 p/ K3 c, N
cross_marquee.innerHTML=marqueecontent
" \- H `7 ? U& w/ Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* p" D( s K* _% C& u4 s}3 `. X6 X3 ?4 r. k" G! z
else if (document.layers){- g0 I3 N G& [6 E0 C
ns_marquee=document.ns_marquee.document.ns_marquee2
D: {; R6 m. K- C1 V0 tns_marquee.left=marqueewidth+88 N' c8 S* k# z: x' z
ns_marquee.document.write(marqueecontent)- G3 z0 c* j1 L' Q
ns_marquee.document.close()
- e# m7 K2 k% T- X/ T9 A# g6 Mactualwidth=ns_marquee.document.width
3 E( q! K7 ]' O2 s; s}, x4 l/ c: [! i- m3 O8 E
lefttime=setInterval("scrollmarquee()",20)
2 y2 e& ?. w! R) Q}
: `6 r, O6 s8 Awindow.onload=populate
- ^( ]1 K1 l& q+ X- T( i) ^
+ C$ F, _/ H" U2 V' ifunction scrollmarquee(){
! F2 b9 R7 ]: C: |* o4 ]8 Oif (iedom){
2 @8 A* d$ M' }* p. Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 u) O: `5 {" z+ ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 S& Q1 t1 N8 j- b Q9 H+ Z4 s
else
- E$ v2 Y/ b: R0 {5 Ncross_marquee.style.left=marqueewidth+80 y& C3 P) o9 a7 v5 P8 S. [6 R$ g2 y
+ z+ T. |5 `( q3 l* a
}$ ]8 ?7 E) ~* z# \8 Q* }4 B
else if (document.layers){
2 S( z# n3 F8 x1 q' Rif (ns_marquee.left>(actualwidth*(-1)+8))
3 E. l- Q+ L+ b3 tns_marquee.left-=copyspeed; b: T! h$ \& r
else
- H2 F( `9 \ C$ ?1 m1 [ns_marquee.left=marqueewidth+8. J9 f3 }7 X8 s
}- T. t' Y* R: }; k2 r
}
. J1 e- f2 i' R0 m4 ^" U
/ A. m) @) n! I8 F) tif (iedom||document.layers){3 @( ?% |0 _) @0 D, A# k
with (document){
5 B8 l& c5 X" [% V! N% {' zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( I' l& D8 g# w M& ~) V
if (iedom){
- p- J6 M, x! Y* H6 ^! _$ Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 z# j9 L' a8 C) ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# F0 X! D% O; }) Z, X$ Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* J* @$ D' G# s H. c
write('</div>')% p, ]7 {0 {! b! u' W1 [, U
}+ w' x, ~; V2 L' W
else if (document.layers){
6 }/ a0 z2 n, \4 Z2 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- h7 ^2 z! ?* ?% R' O7 D* C, S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* w9 Q- S* ^$ ^7 u
write('</ilayer>')# c, w1 B, s% c" s
}1 z* e6 ^. m+ y5 H# n
document.write('</td></table>')
% H, c5 Z1 c1 p6 X0 W$ [}" E' j. B5 C, u H8 a, ?, p
}$ s7 u& g8 R" a7 C5 N" K
</script> |
|