返回列表 发帖

网页之跑马灯文字特效

//修改宽度( r$ M) V$ y9 `- z* \3 X- t
var marqueewidth=300
+ z4 w* r0 t' s( g6 q( L; m" h//高度/ |+ l! u0 e. g* m
var marqueeheight=25, G: H1 n8 n( o
//速度(1-10), S; a5 A$ I3 b: a- ~4 [& W: j6 I* |
var marqueespeed=3& u8 Z0 U3 f$ Z/ j; Y' v
//背景颜色
4 J4 M" |% ^0 W; }5 c- Uvar marqueebgcolor="#FFFFFF"
! E2 T3 B- p0 q  d- t! H//是否能暂停 (0=no. 1=yes)?& J1 x% m2 e" X, s$ O( F: e
var pauseit=1
8 [7 s2 }- a. w( V! m5 a/ K
8 C" H) O$ p! l9 G4 ~7 t4 x//修改显示内容
2 D& Y+ H% n& c5 m8 R. i5 q* Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 Q  g) L2 k* W/ T& G' O. d  K$ q1 q% Q! I9 x* U" B7 `! z

: }9 u' W# A& x3 e' r* L3 A////下面不需改变////////////. r% M! @. n+ q6 k2 m" t

% x' D8 J# r1 b& \var copyspeed=marqueespeed
" p$ R+ Y7 C- j* L/ ivar pausespeed=(pauseit==0)? copyspeed: 0
7 |9 Q- _$ i5 [: b! hvar iedom=document.all||document.getElementById5 V, Y* d) \5 M, D# Q- R
if (iedom)% F1 {/ a9 U) F% H1 h* R3 `- y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  a. R; f2 W/ S
var actualwidth=''# d# }8 O$ ?" Y3 J) f
var cross_marquee, ns_marquee8 g4 e, H9 A& R
! D1 n( U1 u7 J5 ]3 s! T
function populate(){
4 x0 S2 Q& H+ @# Hif (iedom){
2 V& Z9 |" ?) k3 n) h& Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ [) j) q2 G& `) K+ x; o* Across_marquee.style.left=marqueewidth+8
  _) m1 O0 C* d6 y+ ^cross_marquee.innerHTML=marqueecontent
  W' g/ e& W; r6 a7 s4 K/ Q4 hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! u" g# L/ H- k( i2 F, c# u% u
}% X# Y6 @2 ^% s2 v2 Y$ w
else if (document.layers){  C* w4 j9 c. K2 f  L) F6 R8 p
ns_marquee=document.ns_marquee.document.ns_marquee28 o5 H; |8 R+ _/ Q5 w5 q8 B
ns_marquee.left=marqueewidth+8
  w  v) |; ^* [% X% D4 G: ins_marquee.document.write(marqueecontent)% D" [9 k: N0 d) h
ns_marquee.document.close()  Z, t5 {4 S1 g3 b' l
actualwidth=ns_marquee.document.width
5 P6 @! @$ I0 U2 M}
' M9 o) T8 U9 `3 R( e8 _+ }( B$ ~lefttime=setInterval("scrollmarquee()",20)
- Q9 Z: [; @# x9 \' ~4 T* R8 e2 w}* v' ^7 P5 c+ z" s; B- f2 n
window.onload=populate
7 f1 R. e5 Y+ X" T7 ^8 e- c8 q" K- ~$ g4 O; }# |
function scrollmarquee(){) k6 ?* W3 S' E1 ?
if (iedom){
% d" v8 v' S& K. K5 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), ?- M% X. E' D/ Y( ~$ }( m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* k2 {3 b8 Y- T
else
9 ]- H7 V/ @9 g" c; p7 w! O6 Bcross_marquee.style.left=marqueewidth+8/ M1 S6 [6 p$ f6 N2 q
4 e$ {9 N- w4 |" {8 K$ W
}
! t& S3 m. K% Delse if (document.layers){5 i4 R% [  T0 m0 t7 T
if (ns_marquee.left>(actualwidth*(-1)+8))% H( z9 c$ E% O5 r( y
ns_marquee.left-=copyspeed
4 m$ n2 C. k0 j: R+ W1 Selse+ c/ O1 a$ ]; ]
ns_marquee.left=marqueewidth+8
+ p7 f  D1 k0 E. a3 U5 K# g/ d$ E}7 K4 |" K) A' b/ x; M2 l% J
}5 E5 m9 V& k* q. q% B1 v* ~+ m2 \

6 m: k0 C& o% b; {% u+ oif (iedom||document.layers){
. B. x6 P% j! e  \; wwith (document){. L2 |. u& \4 j# s% ]# G8 n' ~3 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% v+ A* \: y( [* Y8 B% Hif (iedom){
, @. h% X& H  V3 F% Q, Y! Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* Z: h7 d* |2 R! u  ?' [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), c0 q2 \# I0 f$ }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 e2 r" i, Y( ]( H: awrite('</div>')+ A8 F2 {$ }6 a) d* K  Y
}
5 |1 a/ {' O7 s: helse if (document.layers){
0 a+ c! `* k" N; Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- Y/ k* o  O+ C# zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! W" Y1 p$ ?+ s- {+ h
write('</ilayer>')/ n* H% ^/ ]2 R6 }) o3 \4 C2 m
}
, u4 J6 u# _5 L: r1 c  ?; Ldocument.write('</td></table>'). ]: C) p- C& ^  `; ~
}3 f. T, V9 A: |: u& `: Q% d
}
8 a4 B: i* a& D; C9 Y</script>

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