返回列表 发帖

网页之跑马灯文字特效

//修改宽度* q0 N6 W. [- ]- A: s. v
var marqueewidth=3007 _6 H$ f6 @$ ^- ~8 X. E' D' x8 n& {
//高度
* J! |( f9 Z( v& m5 ?! ~% hvar marqueeheight=25
/ ^' x: S' i8 E9 \& k  e//速度(1-10)
) E7 J- Z2 x0 Ovar marqueespeed=38 h% e! m) ?0 G; H+ w8 ]5 J
//背景颜色
+ l9 K2 U% s; {- uvar marqueebgcolor="#FFFFFF"# |7 ?( p$ _4 u2 k0 ?
//是否能暂停 (0=no. 1=yes)?. }5 g9 x2 Y8 R+ j4 Q+ k0 n
var pauseit=1
0 z0 M) ^% _; J6 B+ V8 }9 K" p+ P- l, t3 f! ?# g* H, A1 u; j
//修改显示内容
& B0 R- V" A+ d" Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! y6 ^- Y1 g5 l  C% I; h% ^+ V5 v  X) c: K

8 N" O2 W3 d$ B6 t1 }# \////下面不需改变////////////8 P, R; k+ x  Z

" F/ B1 M' j2 q7 R/ f! I  O3 svar copyspeed=marqueespeed2 C. Y; q. s: O* @$ b
var pausespeed=(pauseit==0)? copyspeed: 0
1 G/ |2 m% o% f9 j. u2 k2 R( J: xvar iedom=document.all||document.getElementById7 ]2 D6 n7 t' r  |1 T# z
if (iedom)
; `# k6 [4 p$ z! d' Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ ^7 A. m5 W8 M  L
var actualwidth='') s6 q4 G$ r; q% B) p% @' S# h: j  j
var cross_marquee, ns_marquee8 N) Q$ Z0 v% T- |" q

6 w$ `9 G5 D" q, ^# C7 Yfunction populate(){
0 e+ S7 [2 j+ @+ T2 N( u' x5 b& n/ xif (iedom){
7 k$ T+ D2 X& n0 g! p2 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" l6 t" ^  Z0 B4 a% w& icross_marquee.style.left=marqueewidth+8
; u  R7 Z( }( K: P" g, C5 f/ ncross_marquee.innerHTML=marqueecontent" P6 j% ]" F. k" S. H, P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" |/ U9 K3 N  _' p% L+ X}
$ Q! S+ l% k6 c$ ?/ X. L+ aelse if (document.layers){
* ]0 A8 Z# B  v2 wns_marquee=document.ns_marquee.document.ns_marquee2; I( u( z* x$ {7 y
ns_marquee.left=marqueewidth+83 |, n. q7 [- Y1 n0 D: c
ns_marquee.document.write(marqueecontent)  R2 t5 R6 n7 s7 `0 j+ S
ns_marquee.document.close()# `( C5 e: S1 U  ^9 ^+ e$ C8 Z
actualwidth=ns_marquee.document.width0 s( t; `' `! U8 I2 |0 x( K
}+ c3 Y  A* t: L7 E/ z
lefttime=setInterval("scrollmarquee()",20)
/ J! ]! M, ]5 C2 d}5 L3 r% X( ^3 O0 S0 l2 M  ]
window.onload=populate
: \4 u/ z1 h" _5 \3 b% X; e4 ]$ H" w. B) R2 M6 [5 O  y
function scrollmarquee(){
1 c& n) `2 j$ r( W- H. q! Sif (iedom){
2 J& S) a& w! Y/ z9 Y( W( i3 m: \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' r) |1 K0 i% [1 G: I$ I+ e
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, d! \8 {# G4 M) d8 U: r/ _else0 m& f& O( B7 L8 C7 ^7 N
cross_marquee.style.left=marqueewidth+8
3 t' O+ n4 u8 b' B3 ^( ^& B  e& @* L
}& z: q; W5 V. v8 C5 ]8 V7 O
else if (document.layers){
9 N4 i7 c9 _, C. b+ h6 Bif (ns_marquee.left>(actualwidth*(-1)+8))
& x) F- B7 l# ^, _2 `9 B. Yns_marquee.left-=copyspeed
$ q1 S0 j$ Z7 Belse2 o* H# D; \: N% I) ^
ns_marquee.left=marqueewidth+8
4 [3 ~+ A) g8 f- f! a}
6 @) i8 K9 x, b( O}
/ M+ V+ y7 {1 o% @
: W$ d. b1 @8 S( Aif (iedom||document.layers){0 J. R* [. r5 T
with (document){
8 U$ V) N. l- o0 p6 K" ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. x* S9 f/ K9 Aif (iedom){
  x+ F- U# m. \4 K& e4 C; c8 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% A; B( e7 _; B6 y6 s' X+ C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ ~2 e9 b- N% h$ L. `7 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 t/ `( }4 I$ o3 {3 D+ R) P
write('</div>')
% I" H/ {& F9 g6 F}+ H0 N+ w7 [4 l/ K' F5 m- n" E
else if (document.layers){
& ^- n; ~3 g: }' w1 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% U( y) n3 o% G( P! ?% B4 t9 ]' K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! d, E4 e, H6 `: m& K7 H5 ywrite('</ilayer>'): [0 n. e/ I& v" ?+ a
}
4 \9 m, d* z  c" m4 h- {3 [; Tdocument.write('</td></table>'); o1 e! a0 B0 n  E& y+ e. N, I
}" T" ?: `$ S, f* O
}
$ c: @8 L  K: e) ?. [5 W</script>

返回列表
【捌玖网络】已经运行: