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

|
网页之跑马灯文字特效
//修改宽度5 D, Z7 [$ V& b7 l) u) y
var marqueewidth=3009 ^1 t. c4 n( | Z. s3 ~9 G8 A
//高度
- j0 F* V1 @, S4 N6 Yvar marqueeheight=25
- Y$ C _: Z. I9 L/ ^//速度(1-10)
# V& U5 X8 ?4 O3 z! g. vvar marqueespeed=38 e7 r; C$ a" Q; G* ^4 h
//背景颜色
& {$ Z& e3 i/ B% Z0 N9 x) m9 }var marqueebgcolor="#FFFFFF"4 B* i ^+ C2 a
//是否能暂停 (0=no. 1=yes)?
- G0 M" S% u+ Ivar pauseit=13 L4 F; n& a! l; ?$ {- Q7 }4 F
4 [! A* C1 d/ l2 L# w* \
//修改显示内容) Q) ?. q5 k' Q; L7 x1 ~# U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ y$ ^2 i" ^6 S& i) ?& K: ~+ q2 j4 \
8 O y0 F' Y. M( H% K0 q
2 f O8 B/ N- e' R+ X: A- u////下面不需改变///////////// }$ F, B- w1 m2 t/ ^) J
0 @7 H/ X* j- V9 G5 l v3 p
var copyspeed=marqueespeed
2 b+ K- c3 D4 ~: D- D% bvar pausespeed=(pauseit==0)? copyspeed: 09 m; a" X8 I# N- R3 D
var iedom=document.all||document.getElementById
' p* J/ f) J" o. R6 Iif (iedom)
& D: V& l8 a0 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 \, |: ^, d* I* j# i/ y5 c& k5 o0 r
var actualwidth=''* p \4 h d1 @, M( I) ?0 B% w, ~' H
var cross_marquee, ns_marquee
5 ?7 k9 Y& J- X2 ]
$ {( i R6 q ~% k! efunction populate(){( c! U6 E! O0 q1 p D1 d
if (iedom){! A. @. W k' B* E5 E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 B' F6 S8 o1 j7 _/ P: Kcross_marquee.style.left=marqueewidth+84 D* ?3 ^( o5 a7 p* M! `' b" y
cross_marquee.innerHTML=marqueecontent
0 e" L' D# v# D* g2 W3 pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 P+ K5 l+ K) e- b4 q}
8 m2 o: C6 u# N7 E) N$ I% ?2 welse if (document.layers){3 ^0 B) H( u) Y, J. b8 A' O% M2 u
ns_marquee=document.ns_marquee.document.ns_marquee2
# H1 s3 f' B- `( D7 N. x1 L0 ?( qns_marquee.left=marqueewidth+8* t: ]- U1 a5 p0 _
ns_marquee.document.write(marqueecontent)& h7 b; O! W8 e H5 t
ns_marquee.document.close()" y) J x3 t! P3 Y
actualwidth=ns_marquee.document.width5 L: a; z8 L/ T2 d3 y" ?
}
/ p7 x3 z$ I+ {7 u1 @7 N) {lefttime=setInterval("scrollmarquee()",20)
( t8 M2 z$ O% K}0 k+ k) p2 a$ d& \0 ^5 ?8 N0 V
window.onload=populate' s; M/ U( _7 L$ u& v$ Y
( L. s" U3 d" u3 V. q, ~- d$ n' C; }6 i
function scrollmarquee(){
1 C; b& J" X2 lif (iedom){" y& j4 {8 X" c7 w9 p7 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- r; R' G5 K9 S- W5 @, Q3 d3 g) pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ U8 P2 _* E: H$ n
else% v5 A- g0 y l2 o6 U
cross_marquee.style.left=marqueewidth+8 H$ E; y) |: z) a' v* v( F- N# A
) Y1 o4 b3 C5 R9 a L0 L}0 s* r# v. w$ Y5 f
else if (document.layers){
( H! A* d7 ^4 D$ cif (ns_marquee.left>(actualwidth*(-1)+8)) x v0 U+ g1 o) _4 n. ?* |
ns_marquee.left-=copyspeed
; T4 e2 s; _3 `: Q5 N( _else# h! J' ~8 _) F0 Z, Z
ns_marquee.left=marqueewidth+83 t. D: d0 \! P9 {
}
- x; f/ A1 r# V1 E6 C6 @7 o$ v}
2 l" S! R. O& o$ }) _* K5 r* y4 a4 s0 K" y* ~! Q
if (iedom||document.layers){
# I5 d. j* k- y. a @& P* v1 Vwith (document){
* g; G& T' h/ g! }) _; ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! [# E9 e' d) W, m% Lif (iedom){1 ] k7 ]2 J$ t# i v0 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ x! @* Z3 {8 s# {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% _* Y5 {, M- V; F7 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* b! q- D! k/ E/ A. xwrite('</div>')8 c7 n0 g. g U& c! \. Q" P1 k
}
, l- Q7 z0 X' B* X0 Velse if (document.layers){9 v" v; ~# u0 c* ?+ ?* {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" L& n3 D4 C2 e+ |( w7 R Y% @$ mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 T- ^4 a W! L: F; `3 z1 ], J( lwrite('</ilayer>')
6 N) t6 Y( \7 K}
3 _1 e5 F0 A9 E0 S. j; ldocument.write('</td></table>')
8 D* S. ^' h# }. h}8 a+ b$ Q2 E0 B
}
' H& d) ~' v# i2 y. t b( }</script> |
|