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

|
网页之跑马灯文字特效
//修改宽度6 x9 E1 v8 }, E( c" I4 M- A
var marqueewidth=300
9 r: b) i# R- R% p2 m//高度/ C! W }5 x* G- P+ x5 M
var marqueeheight=25 L- J9 S3 n3 a+ k. L2 r; c
//速度(1-10)
: _& d/ E+ d6 _) M- y6 N4 ]9 ?1 pvar marqueespeed=3- R4 x3 M4 j" r4 f# Y5 k
//背景颜色
% z @& W- N7 o4 U9 ?# uvar marqueebgcolor="#FFFFFF"
6 a( ?% Z) W0 U+ A0 W2 P//是否能暂停 (0=no. 1=yes)?1 k5 v0 n# [* c
var pauseit=1) f0 j& y. m4 o
* g- J: C6 v! h* @) V1 k//修改显示内容
2 b3 K7 X: f$ avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ m* Z/ u1 H. G( B, Y
/ Q% F$ U6 x& h$ \2 l0 y4 f1 \4 w1 q$ D
; e) C2 H( D6 `1 M; ^4 F/ W$ v////下面不需改变////////////
" r! L; V% i! N6 }* m* H9 k: I- }/ a A3 l
% p4 l, c) P5 ~0 H* g7 p% Pvar copyspeed=marqueespeed
! N0 k9 l+ R! p7 l1 Avar pausespeed=(pauseit==0)? copyspeed: 0
/ T; ~' m* U+ q( Q9 H5 Hvar iedom=document.all||document.getElementById
" R* U. C" o4 K/ x7 }if (iedom)0 z- ^0 D* L2 _" K; y% y$ e. I' J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
x" v* J" ~' {4 d- |var actualwidth=''" }. [* f. m1 `! I8 s( Q
var cross_marquee, ns_marquee/ b- P$ B5 k- A" u/ i
- v, B s" O c: a" |
function populate(){
+ @8 |% p% [5 Z: F* T, ^5 @if (iedom){ v. v( [# s2 H0 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 q% w5 h1 C+ g# s! u
cross_marquee.style.left=marqueewidth+81 \1 K. L% f: B
cross_marquee.innerHTML=marqueecontent
; w$ y9 O+ v4 _+ E1 }5 hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( e' h1 B2 U2 | @: e6 o6 b, O
}4 M8 j, _$ w( o7 h5 h9 x
else if (document.layers){
5 B7 |3 _& `2 w' ~ns_marquee=document.ns_marquee.document.ns_marquee2$ ^3 S7 g9 |1 G
ns_marquee.left=marqueewidth+8( W8 a2 c8 q, d
ns_marquee.document.write(marqueecontent)
" g3 n1 e5 @9 Kns_marquee.document.close()5 B: b: {7 r* y" c
actualwidth=ns_marquee.document.width. Q4 O W y( u2 _; a
}
\4 K9 k4 Y+ F& a9 dlefttime=setInterval("scrollmarquee()",20)
* z/ R3 R7 |8 w7 k1 c}
1 ]$ T/ }. h5 V* _window.onload=populate
9 P3 M, T* L: s& ^ [; g6 x1 K4 {) v, ^9 X% X
function scrollmarquee(){. J4 L9 x& H9 P$ [3 J( o$ U( _
if (iedom){
3 G; Q; {& @# v8 L% \! rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: M% I7 i5 O9 S6 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% V, t, {* i4 z( J
else0 c4 N8 T3 K, p6 f
cross_marquee.style.left=marqueewidth+8
2 f" l$ F% P5 P; e% L
( X9 v+ n9 ~) v, S) K( s9 g}
9 w3 |! v- O9 pelse if (document.layers){
% Y" B$ d3 E4 [- Z& @6 `- ?if (ns_marquee.left>(actualwidth*(-1)+8))
) V8 w9 W4 M) G+ {& Qns_marquee.left-=copyspeed
; Z. m( Z" w! x& {else( y3 z6 \- x2 P& F% i
ns_marquee.left=marqueewidth+8
) y6 W: o1 T9 W; f}
4 I: Q8 R/ X9 v# J}4 x' @8 }* `; ~+ V6 G7 Y
4 p5 G* {' x# Z- s* s$ o9 p2 Tif (iedom||document.layers){2 }$ a- r I: u* R# G
with (document){4 n) G% w3 f9 v1 e! |# Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); D: ]% m" u9 ?( S; v2 k5 ^$ [* ? }, H
if (iedom){8 j5 l2 Y9 }, g% S! u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- k, b2 E. o V5 O+ M- e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& z' j' |! l. ]2 J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 i3 z& U' N2 F
write('</div>')- z- |1 W( u4 b8 W
}
% c! y, w# V- a6 K0 [else if (document.layers){
: m* r5 V/ R9 U: b& C, |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ [% z$ T6 x! O/ E8 D# f2 |& H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 o8 m4 O" I' g' o$ N6 \write('</ilayer>')
F9 C( \- K- a' |" s4 ]}
4 x0 _- {! Y( _document.write('</td></table>')
% E# j2 o# h/ o}
7 j( M0 a; c/ ^$ Q/ D" @}) e |% H3 B1 k# y* h, k' U, u* x
</script> |
|