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

|
网页之跑马灯文字特效
//修改宽度
% _+ _/ a7 R+ g4 svar marqueewidth=300 }5 F6 W( P. u( ^1 t1 l
//高度
5 |5 ~$ l/ @& W& Q) c' Cvar marqueeheight=25
' F7 l, I+ N! r9 v' h* I//速度(1-10); O, k! V6 d l9 S4 M: [2 v- L
var marqueespeed=33 m: R% \% R9 y- J9 T: l
//背景颜色* s+ k$ v0 Y3 d2 s O) I2 ~
var marqueebgcolor="#FFFFFF"
* F6 ?* f0 p% m* v4 C6 k% ^//是否能暂停 (0=no. 1=yes)? J9 G" {0 {) c# T: V
var pauseit=1( |3 l9 o! |2 t# m; O/ E5 i0 b* Z1 h
; S- z8 s! }! K# @//修改显示内容; C, z6 f0 X8 T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ G1 N' `% w9 {* K( M, Q$ c
8 X- N$ {0 k! {/ \0 S, y5 c8 p* G
- @( W/ `6 l2 {% C////下面不需改变////////////4 X1 R& i t. h2 z
7 n3 ^: K2 S3 H+ ?, \5 l* v
var copyspeed=marqueespeed
/ R; Z0 O- Y; a- g, ?" z4 }+ B( pvar pausespeed=(pauseit==0)? copyspeed: 0
7 Z: ]- ?7 B2 X& Ovar iedom=document.all||document.getElementById
- F, z) x/ S5 R" M8 r m9 Tif (iedom)$ C# f+ `/ G( [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" e4 f+ E7 Q5 X) _$ M+ {var actualwidth=''5 K: D. A5 @1 D" Y5 L# r
var cross_marquee, ns_marquee K, ]2 U5 Z+ X3 V( H9 [/ e! l
( W/ @/ W! V* b' c! @% ]
function populate(){
6 A/ Q9 `4 I7 R2 G% Hif (iedom){( E2 \$ I$ Z' c8 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, |9 S+ B" e" N8 ]* `/ a/ S
cross_marquee.style.left=marqueewidth+8* @% ^( X6 \1 I" ]# o; f: T
cross_marquee.innerHTML=marqueecontent
2 x5 j! |1 o# i1 k- yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 n. q8 k2 h4 \+ ?
}, b- O2 ~* O$ w* A$ ~' d( G* d) m
else if (document.layers){9 ^+ M% r8 E) e K& H7 q) a
ns_marquee=document.ns_marquee.document.ns_marquee2
M6 |1 S( `8 O7 n bns_marquee.left=marqueewidth+8
" k) z1 R# p6 ]2 m6 ons_marquee.document.write(marqueecontent)
( p% l; Z7 z. Z' lns_marquee.document.close(); m/ j: C/ P- s; {) W6 H
actualwidth=ns_marquee.document.width
! |% P& V" \5 i1 v( h6 v, Q8 s2 |}
* T+ @+ X/ b" a( h) ilefttime=setInterval("scrollmarquee()",20)
. n' |% p- B6 D/ y# L4 G% R( C}5 j, @. X& o2 v: Y
window.onload=populate% J6 y3 G3 a' B p4 X% F
! |6 W6 r. I; n' Y2 M7 g% Vfunction scrollmarquee(){7 U( @* h+ B: ?* z) Y7 V
if (iedom){
+ N4 G! J1 B3 k" ?! sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% r* j) E& Z2 t. j/ _9 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 b, U% O+ q; D4 Q
else
" \+ l' w$ v s# k* ocross_marquee.style.left=marqueewidth+8
( H9 v, {& F0 V
: D$ H- k/ v9 r& l1 c6 `" b}
. o3 N# G# ?8 S2 c. B0 Kelse if (document.layers){
6 f* ~6 ~' s1 R' p( Gif (ns_marquee.left>(actualwidth*(-1)+8))
+ G q' w: G# a4 G! j% ^ns_marquee.left-=copyspeed
) G A7 o: s" E% U% [else
. M! \- ?- @! ^0 x/ R: m7 lns_marquee.left=marqueewidth+8
) d2 P1 w1 l! L% x}1 t8 O" I& W7 t3 s+ V9 ^
}
6 s0 o; h! t1 w2 S, N8 f8 J4 f) ` q
if (iedom||document.layers){
$ D- Z0 n( M% H, U5 K# u) \) iwith (document){
4 N8 F' m3 e& l: L' z! wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 Q- W {. o# F
if (iedom){6 ^1 e- L" y& R# d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 t: h! i7 a9 C, Y7 y. D8 f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): c; S; e0 T4 T5 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ l: ?% V0 X& D# e' xwrite('</div>')$ K k, b& k* K8 ~7 {# U
}
0 X! m; I" x$ Velse if (document.layers){
: m" E! w ~8 T' | x7 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 w: j4 @, }' D) Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ a" m% ~. k2 P/ i9 {# K
write('</ilayer>')
( e7 p" I4 V# Q: y5 a8 _' j3 n6 o3 a}
4 x7 e" ^) |& d, xdocument.write('</td></table>')
4 t- j4 @4 W4 [6 B" O3 r1 Q}
, _1 [1 e; A U2 i+ E}% ]5 e- h# u! O# Q
</script> |
|