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

|
网页之跑马灯文字特效
//修改宽度 B/ j# k7 ~' [2 }
var marqueewidth=3008 S( W* n8 u9 N. B: ]; i( K: J) j" L
//高度$ P! _0 g) t" f( J$ @
var marqueeheight=25) i3 `/ r( B; ]+ d' g7 x
//速度(1-10)& \/ h; H9 w/ P7 m+ D, U
var marqueespeed=3. Z S# Q! k1 f, j' _
//背景颜色% f/ ?% z& X/ e! u) N) x
var marqueebgcolor="#FFFFFF"# ]" D ]& \/ L: l6 R
//是否能暂停 (0=no. 1=yes)?
" N8 U ^6 K7 S6 e; Dvar pauseit=1* Y+ X; P2 Q! |' V' y" G1 f
7 i, t0 m) T. N% q% ^* ^( x0 y//修改显示内容
! B" z2 E, R3 k6 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 `4 g* G+ c; v& \' @7 U
1 J( g/ g! ~3 ]1 G; x% `- e, r
. H2 l! g) x% J4 T# [! P3 p
////下面不需改变///////////// B( } ~) T, m# |- D
) E& l+ D) ~# L8 T: V6 j
var copyspeed=marqueespeed
; f% c5 }, s( p$ cvar pausespeed=(pauseit==0)? copyspeed: 0
2 W) _! {3 W O6 }, Svar iedom=document.all||document.getElementById1 Q; S8 c9 N. Q% J1 h2 d" B
if (iedom)
9 [! R4 Q. F- J0 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) E; G7 K( r7 a0 w* ^' N+ O. L
var actualwidth=''
9 i+ @9 k8 I" K V8 w3 bvar cross_marquee, ns_marquee' H" N* G5 f* Y; N7 R, H) L
5 i* N) u% d `( u8 ]
function populate(){
% Z/ P( q( ^' ~, Lif (iedom){5 }) f$ ~0 }3 D# j+ F9 q8 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; Y& G8 R- S8 l' W) n% P0 {
cross_marquee.style.left=marqueewidth+80 Z# b% ?8 w7 j) @' \! j8 V
cross_marquee.innerHTML=marqueecontent
% T7 N1 u- t9 J! A5 O$ L- mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) k8 S+ ~# O C& c2 k- V
}
: Z- @ Z& _% u# Aelse if (document.layers){
2 \0 A# ^- F! G- [. yns_marquee=document.ns_marquee.document.ns_marquee2
8 G+ v; v: }7 c# @3 ens_marquee.left=marqueewidth+8
; B9 v2 k+ k: Jns_marquee.document.write(marqueecontent)2 L k- X5 f) Q& M7 n8 q# f2 s
ns_marquee.document.close()
) v! | i! _0 q" F* b% Pactualwidth=ns_marquee.document.width% y& n* r. u7 U: f; ]4 _
}5 D0 ~$ ]2 d( E& I9 A
lefttime=setInterval("scrollmarquee()",20)
+ r, G3 L/ x4 @7 K7 e: r}
: F1 q a: C1 V+ H3 ewindow.onload=populate' n- _( W8 k1 ]+ W
" C o! L6 B9 u4 F# f" ^" A" Jfunction scrollmarquee(){
" p4 f ~5 x# L7 ]% j# V7 A. N; @if (iedom){
5 J$ t3 g& v' I$ K' tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% `& q/ u+ t; Q' a) b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 n0 y$ g+ x) G9 Z, q8 A5 r7 Welse
1 `% P1 L1 T8 x# L- Rcross_marquee.style.left=marqueewidth+80 I9 r1 S% n1 P; m9 z/ F' o. N
9 U4 X' c: k0 @5 N7 M5 S: D}
: h' U5 e/ Y% G* K3 N3 Helse if (document.layers){
& O5 D0 D ?5 h R: c( kif (ns_marquee.left>(actualwidth*(-1)+8))) c4 X4 {2 P# n5 W6 V( A, A
ns_marquee.left-=copyspeed# }( W. I5 M; i r% Y
else
) _; h1 B' N+ Kns_marquee.left=marqueewidth+8
3 ^9 |; V. `5 a$ |- G5 u9 k# g) r}
% b( w) G6 a U) f. G}
% ?% n# q& j P& y0 V- s+ o
+ T# y* X( u6 Z3 r9 J/ B! F$ ?if (iedom||document.layers){
4 E4 ?$ K& [0 g, m) Rwith (document){
2 t1 u1 J' f( Q9 Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), _) J% [( h% R9 R% h! W
if (iedom){: R5 \. I- K, g1 c2 g/ a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 t9 R: Y/ T, Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' y' X: \6 S7 w/ f; t: ^9 K* Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* `8 @, P0 [& V5 ~9 nwrite('</div>')( T2 J( b1 I8 K; f1 d
}
+ o3 }" c. t! T% ]* o% {else if (document.layers){% g1 B# S% _/ `: T4 q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), y/ L- @% Q. G9 G) J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); ^' y0 E T; S: ^
write('</ilayer>')
: l$ P) X! e# e. B! r% n* w: ?0 {}
. Z1 R! F1 \7 M! c7 mdocument.write('</td></table>')
0 V9 n% _5 u+ A" H4 j}
5 E* N8 P: V, G- u3 }' z}3 h0 e+ T; l6 a! D* Q' z
</script> |
|