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

|
网页之跑马灯文字特效
//修改宽度
8 y- q, d1 x1 Z: a4 ?, I/ Yvar marqueewidth=3007 v9 A9 ], I4 ?' {. x
//高度
- f' M; I2 w3 h' R* Y' qvar marqueeheight=250 A5 c2 F! r, l2 V
//速度(1-10)9 Q; t" \4 q- R; H/ ~/ y
var marqueespeed=3- ^2 S e6 | V y/ n8 T" d; U
//背景颜色* Q) s( _; t$ H: e2 }
var marqueebgcolor="#FFFFFF"/ F7 J2 R( Q2 y; | @9 B
//是否能暂停 (0=no. 1=yes)?
! O8 ^" M) a3 h5 F- b8 Q( c0 fvar pauseit=1; }) r3 ~# B, ^5 F; A: X
% R( y/ V- v" K//修改显示内容 ]7 P5 i, o7 K2 z" _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 l6 N) @+ x2 s& ^$ \; _0 p2 z2 y% A3 |; u
4 w4 |; M6 A. W, h////下面不需改变////////////- @% R( N' l+ b0 ^
8 G8 F" E) i: X$ X" U3 n
var copyspeed=marqueespeed
6 j. `7 r( `' r7 b( Z6 f. Wvar pausespeed=(pauseit==0)? copyspeed: 06 I/ d' ^6 T# l, b2 A
var iedom=document.all||document.getElementById& ~! s3 C) s8 M A
if (iedom)
( y* t& z5 S" \" {( `8 P- Y! Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
M$ ~" A# H1 ^% r: }; |# Wvar actualwidth=''
. o- v" N% Z! P+ n5 Y3 Zvar cross_marquee, ns_marquee) g2 s0 S8 U% o6 N6 ]. J; T5 F
8 x6 w6 a; e9 jfunction populate(){
6 {8 N5 s i; s- nif (iedom){" h) o4 Q8 [$ D6 J, Z+ I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ U3 r& @& I3 e2 F; n z1 Jcross_marquee.style.left=marqueewidth+8, r P% h( F8 f1 ^, R6 Y, Q
cross_marquee.innerHTML=marqueecontent- F: d- V3 v1 k. L+ ^# a# v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* x) J4 |* x& J2 U' t7 _7 e}8 v$ Z; b( r: f" e' k2 p
else if (document.layers){% \4 F' I* X" q d: L
ns_marquee=document.ns_marquee.document.ns_marquee2
! p9 S' X$ I8 u" `+ F3 U1 R) Zns_marquee.left=marqueewidth+8/ r- W2 K9 T' r i( z6 ~) o% O
ns_marquee.document.write(marqueecontent)
3 e) a% P+ g% W+ }) xns_marquee.document.close()# M @$ a7 n Q& {+ U6 Z
actualwidth=ns_marquee.document.width
: I: H; q z% L' O: u" H/ w( b}
3 n: J3 p: x' x2 M' ?8 i6 Tlefttime=setInterval("scrollmarquee()",20)
( j- A* G0 } X( q2 q}
5 d l9 A& q2 t/ Y% E! `1 ^6 Fwindow.onload=populate
- A! i- }( ^: ]1 Y# T8 O$ f1 o) R8 X* Z5 I% M
function scrollmarquee(){4 ?0 O. [) f* m5 ~
if (iedom){
* F4 b6 \- b- w, `3 I8 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ W2 V8 ^. o1 z; m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ r; M. f# Q1 Relse
, |+ f+ A+ ~* O# J) Hcross_marquee.style.left=marqueewidth+8
. d. s( o5 I' B4 G7 D Y* r$ v! w8 Z' a$ U4 i
}
: x( F, z3 p( K/ kelse if (document.layers){
R# _) E4 G& X$ Jif (ns_marquee.left>(actualwidth*(-1)+8))
. X/ z" N$ j7 T* S" P* n$ d! ^ns_marquee.left-=copyspeed
* Y1 U: Q$ v4 O5 N( Yelse
) {4 Q9 `4 n2 x* v1 _' M. A# ons_marquee.left=marqueewidth+8
: y) o% p [) v V( ]}2 G8 s$ a1 T/ M3 u( H
}- H; ]$ V$ ^ q
4 o2 t+ N. z, H8 D: ]3 @- @if (iedom||document.layers){
! L( v" u, c6 L: g- ewith (document){
6 x/ E- M% x; Y, G7 @; v) j edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 O E) @- m, s5 D/ w9 s3 t- Mif (iedom){: j( t7 r/ p/ A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ Y& }: d6 W8 I$ h @5 W5 [/ Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 ?8 w4 K3 L- Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) r @2 b- ~& t. [5 G+ a$ t% y1 _
write('</div>')
* x: n" R& @1 m, f$ b* A2 U8 C}
, i. V5 Y {4 `+ }else if (document.layers){4 d& r( c! X; v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 f% |9 S7 O0 m( R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% d6 H; V. Y; x
write('</ilayer>')
9 _/ `- b! w/ h3 q& P5 }}
# H5 `: H, V- q" Fdocument.write('</td></table>')
: T s5 w. Z; q* d}
' @5 E2 a3 C, S+ e}
# b+ b% _1 t: T; I+ d q</script> |
|