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

|
网页之跑马灯文字特效
//修改宽度
; K6 U& J# j2 t- J4 C8 Q; t' I' M+ _var marqueewidth=300. ^" G2 g) z; p2 q$ h# Z7 j
//高度
- U- \8 n' H& T1 B/ a; v% q/ Uvar marqueeheight=253 S& ~% s+ b* \+ r( V
//速度(1-10)5 C" C* O+ L( Z
var marqueespeed=3
- J- Z# F% }% S1 ~9 N' g//背景颜色
: P, `7 r3 U7 u- ]7 Fvar marqueebgcolor="#FFFFFF"' f# k1 ?' b. F8 o! M! O
//是否能暂停 (0=no. 1=yes)?
2 o3 T( e! C+ uvar pauseit=1
8 B1 d: s# T1 o% f2 A! d" g. }- a9 d. ?# E
//修改显示内容6 [- L+ `1 k) [% `, i/ u$ s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 H+ y g g$ Z6 I6 B8 q5 V. Y
: ^5 U) p1 w: w4 ?
, ~6 u# E& h8 V8 Y) W7 k5 d////下面不需改变///////////// N$ @4 C% H( ?
6 m5 ?! R+ f5 {6 u
var copyspeed=marqueespeed' b; e, s6 j. j
var pausespeed=(pauseit==0)? copyspeed: 0
) Q8 T; s( b# b8 v J/ Q. J8 h% s5 lvar iedom=document.all||document.getElementById" V! a; f5 B9 a% `2 `' i
if (iedom) ~. h8 E5 M+ A6 ]; M) w6 {( h5 v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( s: M7 l) D2 p% U
var actualwidth=''$ E* `% A8 l$ R9 \
var cross_marquee, ns_marquee
M3 w# Z4 O6 i. P8 d* b a; Y# }* d5 o6 p
function populate(){ z7 K: B& v2 W7 e
if (iedom){
/ T( h4 g! l/ `; o3 k, ~9 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee J1 M6 ?6 d- _: v( F; {' G! V
cross_marquee.style.left=marqueewidth+8
/ n, o. {: Q* |cross_marquee.innerHTML=marqueecontent! p$ _! k" a8 w* {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ R/ P3 W2 A" f}5 B* h3 X( E8 F$ K! ?9 G* I" }
else if (document.layers){
7 ?1 O6 O$ e3 u6 W* P; O9 bns_marquee=document.ns_marquee.document.ns_marquee2) I- p" u4 l! K( u
ns_marquee.left=marqueewidth+8 v: q5 ?6 h {% ^' J i9 {
ns_marquee.document.write(marqueecontent)1 X% e# x, ^. Z: N/ W) r: e
ns_marquee.document.close()
6 n9 O2 |5 u2 `8 d1 S& b0 Iactualwidth=ns_marquee.document.width u6 H O! ~/ R1 C& _5 F$ |
}& E& K# q5 y8 W$ F9 U4 Z4 x
lefttime=setInterval("scrollmarquee()",20)) m8 S i5 Z+ r
}+ e" i3 B( d4 Z: ~
window.onload=populate1 L& X+ |& `5 \* r) a
7 N( q. U: t" v: U3 I, P
function scrollmarquee(){
2 W6 ^$ i9 |% S6 J+ X- \% G, Uif (iedom){. [4 ^0 D/ S7 T% I; b( m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! i$ E7 o7 {2 M7 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 Y% Z: @ i, _2 h5 ~; H' I( ?5 u% ~else
! D! x( {1 G- I% Icross_marquee.style.left=marqueewidth+8 t' _* W T& c* c2 i+ p
, j6 y* J$ T! g H
}
9 y$ L/ n: h$ M, w+ E0 n9 _else if (document.layers){' y. L3 G5 c- O5 K) ?" d, U) {: x1 c" l
if (ns_marquee.left>(actualwidth*(-1)+8))# s6 T" {, E. {/ Q. ], X
ns_marquee.left-=copyspeed& t+ N `2 I% d/ W7 ^
else/ A' R* ^; R# ?; g5 v% i/ W; n
ns_marquee.left=marqueewidth+8$ R( p) t, E! c$ U9 Y
}
( G# m i1 g0 N}
% @( n; e" C* x9 v
# ^0 O3 L, D6 Q8 hif (iedom||document.layers){1 b9 {3 y' W4 w5 N& K5 J
with (document){
% T |0 e9 _$ P3 [, Y" Z- N2 A7 kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- g7 V. d1 g' v% w$ w0 s, b
if (iedom){
& ^" L1 U8 |, d5 w6 k0 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 |( k1 N# a5 j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ~7 u0 K# ~' H& _+ `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ t' e9 R7 a8 Q+ pwrite('</div>')
3 ^6 Q; D, j! G9 s' y3 D: a+ Q}7 T1 N; C$ \- {4 ^8 z* \( Q
else if (document.layers){
: z4 c; {0 x# E5 j& Z" i$ Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ d4 v) i( L' e4 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" R' y8 c ?5 N8 W: p2 o1 i9 ~2 A4 |write('</ilayer>')
6 C" b4 l& T0 ^0 c/ g3 z& t/ r+ ?}
* C; y0 V! i2 T1 ]6 |document.write('</td></table>')5 L1 b) V9 A5 n6 |& b& K9 T) d
}* M: c$ C% K# x! g% M! h/ z- s" ~
}
, a9 _, Z4 ?# Y! A2 U2 e</script> |
|