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

|
网页之跑马灯文字特效
//修改宽度
! A5 j- d- N2 o3 U; [var marqueewidth=300
8 @( ?8 ]; v, C0 C//高度; G) K# T7 R: ?+ s! o; A
var marqueeheight=25* P, E6 @ h, c; z# x, h
//速度(1-10)7 P% a' m( g4 N: R$ ~: y6 q
var marqueespeed=3
6 F: c& Q9 l6 H% g3 X//背景颜色
- h) K! F8 G5 a& _' V) @' N' Q; yvar marqueebgcolor="#FFFFFF"
6 r$ C$ i E6 _: m) ]//是否能暂停 (0=no. 1=yes)?
5 `1 Q- V9 x5 ?7 W2 K; [+ Rvar pauseit=11 q! A# |; ^) ^' {" J- T$ |2 v6 ]
% y/ ]+ J1 l. a1 g4 x1 \//修改显示内容
8 `. ], s! b% X: z' ]1 e6 M. Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* k. ^! [. Q& V9 d" u
2 Y, H7 I7 [* ?) v& b9 c0 l& i3 W: `
////下面不需改变////////////* U& h9 v* S/ Q
+ w& d- `& J" g( ]7 fvar copyspeed=marqueespeed- m7 `% h2 a/ m$ H3 D. Q+ v
var pausespeed=(pauseit==0)? copyspeed: 0
$ U$ w+ S0 E- P8 wvar iedom=document.all||document.getElementById
. Q" S3 V+ R9 J, b0 Zif (iedom); _3 A- ], a$ b" M+ K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 H4 g/ P6 u- W0 [% s& Ovar actualwidth=''! A& ]7 c/ x c
var cross_marquee, ns_marquee
& Q, z7 C3 o, a) e
4 X- e! V, @/ X6 c- u3 B/ @( f5 M& jfunction populate(){
* w% D" _% c8 a* d7 r6 bif (iedom){8 x9 X8 x$ \3 O8 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 a3 J' [. E% k# w: i
cross_marquee.style.left=marqueewidth+8! N1 B3 y0 @$ O& U; @& h
cross_marquee.innerHTML=marqueecontent
8 M. z+ J \2 wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 t" c- x0 N" {4 E$ e" @) h}0 [3 H# }$ q% r f5 J6 M3 M; \/ {
else if (document.layers){- h$ m1 L3 n8 R
ns_marquee=document.ns_marquee.document.ns_marquee2
! \8 M8 a O1 @; p" |9 M3 A7 d& @ns_marquee.left=marqueewidth+82 X2 |3 G9 [( n- m7 d5 m @
ns_marquee.document.write(marqueecontent): Q7 \% |) ~% @ h! G
ns_marquee.document.close()
2 J0 ] z: N( q% Kactualwidth=ns_marquee.document.width
( Z9 `9 [& B1 m6 y$ g4 ?}" c" x, e |+ ]2 |
lefttime=setInterval("scrollmarquee()",20)
7 A0 @1 }. c, g6 S5 g7 F: X}% a: Q" s( K# e
window.onload=populate
2 G5 h+ I8 B; q5 l5 R' }+ b( U' @% @2 J& ^! F2 E' u
function scrollmarquee(){" h W# P# H! S4 X% B# L& N% c% T
if (iedom){
6 f+ e, V J3 V1 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 ^) U2 h. c/ q' U5 k5 s. @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) V% A4 y/ E3 I. Relse
5 q3 Q+ P1 W; F' jcross_marquee.style.left=marqueewidth+8
7 ^0 C1 E5 O6 n% p
$ J0 i3 }) q$ b4 V K/ L) a}
; l$ H3 e% Y: Uelse if (document.layers){4 r7 M5 Z- i: w9 t) [
if (ns_marquee.left>(actualwidth*(-1)+8))
. ^' ?6 J3 \2 Q1 \ns_marquee.left-=copyspeed) v0 j. p5 U; _/ K4 x6 x/ l4 s
else
9 r0 q! X9 H3 W& o* jns_marquee.left=marqueewidth+8
1 V2 p% f9 o4 }+ o2 [) V$ H}- e& }+ b( x1 g$ ]3 q: p
}
# b g; o, J3 f# z
( d K7 o9 |0 \: ^" pif (iedom||document.layers){" R/ e2 c0 R/ {' o
with (document){% _4 t; ?' G u; w! U* x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# `. V$ T7 D7 r) [
if (iedom){) Q* h! x9 p; K% r% [- f/ Q* X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% u( M3 w) C4 E# y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 a% }! J4 P4 n( g5 g+ H) _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 E y& j0 p: a) n2 Jwrite('</div>'); r; e7 m5 h4 N; p9 L2 T
}- t, z- d+ w3 H* W) \* I
else if (document.layers){2 q& U1 |' `4 m5 R+ z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 @; U5 P( T4 |9 mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ l7 {6 F( O2 Y8 J3 y5 `+ r2 U, h/ gwrite('</ilayer>')
" T0 B+ ~! G$ l _% a7 k8 K* \# g$ {' l}
+ E& k% |: Q5 ^& S% A$ x1 _document.write('</td></table>')
( k u+ ]7 y% I}4 ?6 Q: ]# D) K5 [ X# s
}
0 k* y* E W! T) @' ~* X</script> |
|