返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 J6 V- C+ @* W  [0 M+ jvar marqueewidth=300# E7 M% f' t, ]; u
//高度  K( L0 i3 c0 p
var marqueeheight=255 R2 J" f  [! V2 D* K) x
//速度(1-10)- d; M/ X1 X9 L! A
var marqueespeed=3
3 s" Y: q8 F- e//背景颜色0 R; p" r; B% j3 y- h& P
var marqueebgcolor="#FFFFFF"7 n, e& C+ d$ Z/ ]1 y
//是否能暂停 (0=no. 1=yes)?0 M) d8 B4 M+ P% u& D# N' P
var pauseit=1
& K! r" c: S* Y5 H9 @3 C% {6 o- Z2 l" {: Z& x1 ~
//修改显示内容
: r7 D- j: u. Z- N4 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 v% L$ Y- ~; X  }( z

1 {5 G( F/ \6 [4 s- Y. D; O4 u# K3 |! M; k! }
////下面不需改变////////////
2 P0 p" X" a8 @, @1 G; E- F( K! p2 f$ s8 x) F
var copyspeed=marqueespeed; q  \. W8 p# d
var pausespeed=(pauseit==0)? copyspeed: 0/ @  N3 F2 ~. }
var iedom=document.all||document.getElementById
, ?% C' t" b+ i3 m+ V/ dif (iedom)
7 X2 l6 S  l& n- xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& A8 G( J9 o4 b" A) c' Hvar actualwidth=''
$ S9 |& i; l+ ]" b! Dvar cross_marquee, ns_marquee
' w# h4 w& G% U& [$ C0 R/ C: D
function populate(){+ K; I1 C- r. r: n
if (iedom){
; Z& B- |- p6 {" @, }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! y5 |* N* A  a, |$ M: w9 m( Y1 Ucross_marquee.style.left=marqueewidth+8$ g& ]. O* r! x) N5 S
cross_marquee.innerHTML=marqueecontent
* o9 E2 p2 u* M' P* T# y1 V1 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% V1 Q- y: z3 ]7 p8 r}4 I4 |$ g" e) F; o: ^# K# r  H1 |2 o
else if (document.layers){
: M" l1 }6 [1 [) i- x; V1 k. {ns_marquee=document.ns_marquee.document.ns_marquee24 G  V1 M/ G! i1 o# F
ns_marquee.left=marqueewidth+8( i  f3 W. p, b) `: W" e( t) a! n
ns_marquee.document.write(marqueecontent)
' Y1 [7 W$ l, B2 `2 f" ans_marquee.document.close()$ ?4 ^) z7 E0 M0 p* O! K# b; M
actualwidth=ns_marquee.document.width" U& ~# t: l; E( w- t# ~6 q; H
}
7 S% @8 b" c: U3 \( tlefttime=setInterval("scrollmarquee()",20)
% h) z" E# J) N3 n  e}
% u0 w: Z, j; W4 P) {window.onload=populate0 o: l9 y1 I5 D3 @

$ q) r! D. r$ Q. I8 ~function scrollmarquee(){
8 {& r" r& F" L8 _; }$ k% O5 eif (iedom){8 ?; c7 ?/ |8 i  [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) S# E1 G# b+ i$ s' Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* F' z' d! A. b2 helse
; A2 F( d& v/ J5 w6 W# w5 J  ocross_marquee.style.left=marqueewidth+8
0 Q) @; u6 j$ i: T0 u' [9 h/ F4 V6 o0 {; e$ `4 N( ^- Z
}
, }- M+ X. }3 P# F4 ?2 Selse if (document.layers){
7 L. Y  _( x& n/ _/ ~$ e3 q! Aif (ns_marquee.left>(actualwidth*(-1)+8))$ [% v9 K8 b2 G! W( h
ns_marquee.left-=copyspeed4 D1 S, @. X$ U* H% W6 K
else
- b, G7 R2 d( K& gns_marquee.left=marqueewidth+8
+ j4 }: B. O9 J}5 H( b8 @3 z- [; A
}
" R& @6 X8 F6 {% n1 E( R
' T8 C  Q( D" J0 f( Mif (iedom||document.layers){
! x8 j+ o# _- G. J* R; ^9 d8 ]with (document){
7 ~/ M  x4 E+ V7 }7 P# o1 X8 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); a" z- ~. p# n4 p" |
if (iedom){
9 D0 `4 g  w% a2 |7 q/ u- Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ i' I; w# E' X# y  e* F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- O5 R  ^4 G/ ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% b! K, [$ ~. vwrite('</div>')  Y1 E0 ~' y) Q& \
}/ B6 C' }$ U( @1 }% D
else if (document.layers){
" {3 C' e+ k& B% M+ v% e2 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 z% x# g! l% ]3 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' d& n) p" q9 U) m& t! a
write('</ilayer>')3 a/ _7 Z6 X+ J% [9 |7 B
}
! J) e5 s- z: E& _. J, c; ldocument.write('</td></table>')
$ D% v, L! F6 w}
9 |5 E$ T& j: x}
$ j* K) H% R- F- b& D; Z% e</script>

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