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

|
网页之跑马灯文字特效
//修改宽度
^, S! D- N1 n9 nvar marqueewidth=300
' U0 b/ ~; c2 q! B//高度
/ u& f1 {4 v6 I1 m% C- ~var marqueeheight=25* v( W* a. k; T" y1 f% k3 K
//速度(1-10)
( M1 H' `6 B. Y, P& v- a$ _var marqueespeed=3- }( `2 A$ D7 i- [" T
//背景颜色1 N |& j5 L7 D0 Q/ a. s
var marqueebgcolor="#FFFFFF"
M- b! B3 z& f) Q//是否能暂停 (0=no. 1=yes)?
! U* F" ^6 S. X9 ?var pauseit=1
4 |! u% X% ~$ G; `/ O8 _' G2 C, F+ ?1 t+ c N+ Z) p
//修改显示内容9 F0 c8 v1 u4 \/ Z4 i/ J& \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
A0 M- m; ^+ W& l$ ?1 D$ i+ W+ p5 p; b2 }$ o
9 M+ h3 E+ |) D: I////下面不需改变////////////' i1 w" {9 x! s, d* P0 `- g
; \) ?3 X; S- ?5 l0 b! c
var copyspeed=marqueespeed
8 h9 H* r3 E: D: S kvar pausespeed=(pauseit==0)? copyspeed: 0
4 e6 I9 X: q' a7 y- Lvar iedom=document.all||document.getElementById D* u* |' z" t, H0 b: A6 M7 F
if (iedom) }8 z( L+ k. ]0 U% p) l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 [' J( \! ^$ d8 avar actualwidth=''
9 x" J$ i, v/ k0 I4 {0 Hvar cross_marquee, ns_marquee/ G1 @- K/ K4 p, p- a
, ^* n; [- o k5 n, T
function populate(){
( ^% ^: l) V% P. \! D3 `if (iedom){
3 x+ l: c1 }: h4 [! lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 s* ~! H0 E1 s) _- r1 p- `. }" ecross_marquee.style.left=marqueewidth+8
& `2 t, U6 W5 d& ]$ dcross_marquee.innerHTML=marqueecontent- d6 a9 r6 Z @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth M ? B7 ^ n- V# Q7 x/ Q
}+ u3 B" U8 \ B
else if (document.layers){ E: _# k- _0 e7 N+ b
ns_marquee=document.ns_marquee.document.ns_marquee2
6 v; u1 b$ s" `ns_marquee.left=marqueewidth+8
! |9 V! T) O( J+ Yns_marquee.document.write(marqueecontent)
, y( W( n4 |1 g2 z4 i! `ns_marquee.document.close()
! Q) l' A- V! v. i) Iactualwidth=ns_marquee.document.width, t- s3 D6 R) s: d5 R, U3 m6 v
}2 [5 g h" X$ T
lefttime=setInterval("scrollmarquee()",20)% l0 X" d1 @+ s4 R7 W) X
}5 X1 I# ?! ? m
window.onload=populate( f4 B8 p9 V2 M/ w; U$ p$ G( [
; {5 D$ T$ n6 t) e( A& z5 u
function scrollmarquee(){
- ^7 d# h5 N; {3 U; {, ]if (iedom){
6 b* U7 c0 v6 L3 J3 Y8 H8 dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& M( ^& S; T( N( C8 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 X( e, b5 Z2 ~8 f0 w- D
else
4 _4 C: H( p0 u9 scross_marquee.style.left=marqueewidth+8+ g J4 s* a0 y W6 E) T; h
1 \! j. w, W6 Y. U" n$ D& Z. Q
}
2 X# i3 H1 O( t7 T2 G3 G6 ~else if (document.layers){$ q& n9 F, d) Y) ]5 r
if (ns_marquee.left>(actualwidth*(-1)+8))
. X9 [( O, B, t( T+ J% zns_marquee.left-=copyspeed- ~9 y: E9 _% M9 x
else+ s0 }+ ^3 M$ z- L
ns_marquee.left=marqueewidth+8
7 f; g2 r* k" i: g0 O" E}! z* g; f& Z, j
}& n# \. {) W2 y. h, U& ?8 U
% `* `7 ^, H8 \3 a! f5 S9 Tif (iedom||document.layers){
% W9 u6 _" n5 ?& `" uwith (document){9 z {: I" [" s3 n {9 [0 w, s1 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' ?& d2 G! t9 y9 T4 y
if (iedom){6 m9 h1 v1 m* G# @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 @* D0 M, W/ K) h4 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" @$ f) T* h J6 D: S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 j1 B2 k) P( b$ D0 I* J
write('</div>')
* h' Z; [/ O1 [- k* G. f}5 h( o& I- P+ {& l- [3 `
else if (document.layers){
5 Y- W' R+ q" r1 ?8 D( wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 b/ S5 Z# U1 q. D" D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 {0 B3 z3 d6 x: b( `8 }4 ~write('</ilayer>')' n5 |% q* A. P& ?8 d# j$ m; D
}
! j$ n# Q, B5 n' y( N% Bdocument.write('</td></table>')# y$ S' r* s; O ^
}
, N1 l! c0 E- W6 X9 z}
9 C9 y4 r! _) O u7 S/ L& l</script> |
|