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

|
网页之跑马灯文字特效
//修改宽度
' `1 c. D6 K* f. d( ^0 ?var marqueewidth=300
% @3 L# W6 V) r. i/ V1 }8 D//高度3 B# o. ~! Q, _ H
var marqueeheight=25
8 h5 q% j& u4 f7 T//速度(1-10)+ n! `+ o z1 o# S2 a% s! \
var marqueespeed=3, ^3 r, ~$ W& y \% a* R
//背景颜色
9 O; r; c! {6 l6 [var marqueebgcolor="#FFFFFF"
3 ^$ e% o3 ]1 X/ s3 O7 S% A//是否能暂停 (0=no. 1=yes)?
. v& n3 L; \: _+ Z: P$ Qvar pauseit=1
) n6 j* [, R$ Z5 _. |( r- s$ s9 l0 n/ I% P7 p; `0 x _5 u) J
//修改显示内容
' |$ y$ [/ M2 k& z3 V( Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
U- {& c0 T6 Q, S% q, }
/ ?# C' _- V9 Q0 H; ?& k) C/ q2 S+ m
# N. L3 d$ ]% o9 o////下面不需改变////////////
. B2 f& @2 a8 e+ d$ f
1 J& x6 I. v7 @7 `var copyspeed=marqueespeed3 E' q: ~# x6 ~( F* [
var pausespeed=(pauseit==0)? copyspeed: 0
- X! V+ f u4 \/ O0 @6 yvar iedom=document.all||document.getElementById' C- N/ T0 q/ w( o i3 ]+ ~& f
if (iedom)
* y2 K8 J3 c2 I4 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ Q3 T- o# w x+ G7 R3 w
var actualwidth=''5 h/ D: x( \$ I
var cross_marquee, ns_marquee
% Z# f/ P6 q: P/ b1 [
6 p4 A8 {3 v) Kfunction populate(){
; G9 E( g/ }' F: {5 z" Iif (iedom){' m! M! `0 f( r# l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 L( c2 w2 ^; h% T5 {
cross_marquee.style.left=marqueewidth+8- t3 O8 y; M! U( g; ~/ \9 j
cross_marquee.innerHTML=marqueecontent
( t6 b; X/ T4 h# o8 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 d) p: ~; d3 y/ Q* W/ Y9 U" k
}
* N! T" K8 W% k0 {$ selse if (document.layers){. L8 _4 l7 ^+ Q3 Z% p
ns_marquee=document.ns_marquee.document.ns_marquee21 h' ]- j" F, y5 y
ns_marquee.left=marqueewidth+8
1 V# ] q& p) u; F$ I5 {ns_marquee.document.write(marqueecontent)
1 ~. j/ s4 n' ^) u8 Rns_marquee.document.close()5 I |' F" o4 [; |7 h
actualwidth=ns_marquee.document.width7 f! |- e; ~5 t+ v) }: P
}
9 {9 X5 n% R9 d9 S- O) k! ulefttime=setInterval("scrollmarquee()",20)
& a2 h* X* [/ c}
' U* N6 n; F+ _window.onload=populate4 c" ?8 G J$ C
- r8 J4 I9 M) J
function scrollmarquee(){, ]/ r( v5 H: ~) P/ |7 Q
if (iedom){7 w4 {$ R( _; q7 F8 S" [ Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* i+ v7 U2 _1 b- ~& ]$ a+ w* _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 u" a# G6 K' L8 J3 S/ B
else( M5 m' L0 k6 q" h' c
cross_marquee.style.left=marqueewidth+8+ w3 g" P; u1 a8 y! W
0 X: [9 M3 W' X$ i5 n+ f}6 ]8 Z2 |8 ?; B5 F9 A
else if (document.layers){! w0 s+ v: ]2 u; a2 u; }4 U
if (ns_marquee.left>(actualwidth*(-1)+8))
, P x: ?+ {2 bns_marquee.left-=copyspeed
) m% }2 Z2 i1 X; o' @7 eelse
1 _) S+ x# m& \5 l, u; F; }ns_marquee.left=marqueewidth+8
# K' Q2 `' \3 {}: {% `5 h3 U1 T' A; ]( d' K
}) y. J" r R; V5 f
% y) K1 Y/ ^, u3 t, }8 y' a6 zif (iedom||document.layers){, \+ }2 b6 g" r& i9 \+ ?: Q1 _
with (document){
1 L& W3 z2 x. b3 N- U9 U0 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- k; h9 x* i. o W/ ]' w
if (iedom){
+ G7 j5 y& S: x9 t- ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 A( B3 h, O3 \6 D' x7 ]0 Z I. N) K H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" S6 d2 o: d2 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' J' y( a4 t; ~0 Awrite('</div>')
4 l0 p7 h/ }9 q6 _}
2 b8 [/ `% {% T, F7 R2 ?3 Melse if (document.layers){
4 {9 ^3 t2 x9 f, p; C5 U# g& Z# `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! C, |6 ?+ i" z1 c- ~: h# P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 f E4 Y* _: Wwrite('</ilayer>')3 z3 ?- \' z$ P: B
}0 |* q+ g0 D) p0 a3 z3 e3 T4 I8 @
document.write('</td></table>')0 g5 ^3 ?* ~" q- M
}
0 u0 N* \/ X) s2 ~& l |7 Z+ v! ?}1 \. t1 g4 d9 ^! M# D2 m. g
</script> |
|