返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 |. i8 A/ L" U! v6 Tvar marqueewidth=300
1 ?4 Z5 f/ v) X5 x, G1 @8 r* c//高度
" {/ q% c1 c% }var marqueeheight=25
# v. [1 ~; H% s; t) d//速度(1-10)
) @1 I. M/ a+ n* f3 B; Pvar marqueespeed=3( A+ N5 _- {* m/ ]6 C
//背景颜色
: M% Y. q$ [- r; N9 k. yvar marqueebgcolor="#FFFFFF"
2 N; `, R. x) C//是否能暂停 (0=no. 1=yes)?
% V. j+ D1 C& M/ N: j. vvar pauseit=1
/ _& V: P- l0 K* w) F, ^$ _0 P( U! j- R9 l
//修改显示内容
* [: ^6 x  Z# T, |9 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': p8 @) |7 c% S9 n/ q/ B
7 c; e# u" s3 g) u0 [

* F/ ~/ ^* e" w////下面不需改变////////////( c( h' c9 o; A) {: m$ q

0 D7 J" d$ |2 \  e. T; Kvar copyspeed=marqueespeed" T8 L" H# w+ J: G2 N+ x. k3 d
var pausespeed=(pauseit==0)? copyspeed: 00 Q; O. U5 F1 d4 f) J
var iedom=document.all||document.getElementById; j! `2 J5 {9 H5 J
if (iedom)) ?$ v) ]! W" t8 t4 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 b4 @. F( C7 Z+ a
var actualwidth=''
: F! e8 ], y& F. y( ]  _var cross_marquee, ns_marquee
4 y* O4 r) c. G9 A! x  s; s* o/ _- G) p3 \
function populate(){
6 n! `: _  \% }8 m- M# C' u5 K7 Nif (iedom){. S- _6 I) t0 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 m& h2 h, W. D, g; ]& b
cross_marquee.style.left=marqueewidth+8
+ J, z6 m& t& [: v% H2 y# Vcross_marquee.innerHTML=marqueecontent
. f5 v" @* N6 ]- J6 z0 L% pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& u7 M* e: `; @
}0 `, f9 l# f9 Y/ Q4 h6 X
else if (document.layers){) M; f2 F0 p/ n, x& D
ns_marquee=document.ns_marquee.document.ns_marquee2
( W9 G/ C$ _) X3 gns_marquee.left=marqueewidth+8
0 ]! n8 k1 G8 A1 ?3 p( Gns_marquee.document.write(marqueecontent)2 A* A. z: V% H: i* h. G( I
ns_marquee.document.close()  C' i! f' I8 e* }2 I
actualwidth=ns_marquee.document.width0 w: F) [  s5 q# o$ z( i
}: C: g9 ]5 [! t% q, n% p$ P
lefttime=setInterval("scrollmarquee()",20)( i2 ?: W! j- G0 A$ Z" q
}. g) E$ h2 V: B9 N
window.onload=populate
7 L+ i. R0 P/ n+ U, F3 C# f6 p9 P9 e- P  B, B) O/ K3 b& a
function scrollmarquee(){
8 c. _# I# @+ v4 I, }if (iedom){* S; ^# W4 U9 y- B0 A: w/ {4 m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! R: ?& A5 w% jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. u4 f1 t+ m& @1 y) K
else
6 r, v9 }# y/ n4 ecross_marquee.style.left=marqueewidth+8& U# N4 F9 ~/ G

0 U+ h% N% v7 A}
1 X. ~, H4 z, U" V8 Telse if (document.layers){
/ N% G4 E: M- r9 wif (ns_marquee.left>(actualwidth*(-1)+8))
5 [& m* ^- b+ _, kns_marquee.left-=copyspeed
* ]% |- B: G( Q/ Velse
+ Q; f2 o6 C* J  F8 n- }+ E( K! lns_marquee.left=marqueewidth+86 M  f; p- J% b& L0 |/ b8 c2 l
}2 a6 M0 s: b% b
}
: @/ s7 }8 c; Y1 S" {0 M  n8 u7 \: H0 f& `' V+ U
if (iedom||document.layers){' R8 n8 z. j5 d* _" C
with (document){
7 w) b5 \/ x  e- _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: E$ c1 J# y, e  ~% V* Q. B1 _# Kif (iedom){
7 p3 _" o  c6 P% Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  ~* h5 i' k' ?4 b8 J4 A& Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, E+ X. ]7 e5 M9 W% Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 M' \0 Y$ X! i3 e: P) Lwrite('</div>')
: r1 w4 ?( Q: F# I, k}
8 T) w& \9 m/ o4 F7 oelse if (document.layers){
3 O8 g+ F1 ~  \' ^: T5 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 F$ b* ?  i: E. @  j% zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" G  y8 K% _. G/ [' [* }
write('</ilayer>')4 C: R4 d$ a9 r  q
}3 b% A# C- I# i
document.write('</td></table>')- C8 R5 q$ w; C5 r# M  Y
}
* N% i8 a; O/ D8 u}
, c7 c( S! @/ e) p4 Y" M, A) E, T7 \</script>

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