返回列表 发帖

网页之跑马灯文字特效

//修改宽度, T8 ]' g6 P1 k! F8 s2 B
var marqueewidth=300
2 Z- A" |5 O7 C) w5 \8 P( j//高度
, n+ |6 a7 i* p# e$ Q/ T$ ^var marqueeheight=25
3 w6 ?$ M; G1 G//速度(1-10)
& b  ~; V/ C7 }: T, Cvar marqueespeed=39 X: j8 H3 \8 h: B* Z( K% X$ P
//背景颜色
2 r1 f; ]9 V2 ?, ?9 [( D* L. gvar marqueebgcolor="#FFFFFF"
0 V3 I4 w! B2 t1 x//是否能暂停 (0=no. 1=yes)?
1 x" Z+ u" i, Y7 ?) j3 L+ H1 h8 v/ r2 ~var pauseit=15 |1 _0 G4 t, ~  D+ ^

( [5 l7 _" `& U! p//修改显示内容
( o0 y$ l" u. g# d* qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 y& x8 ^) ]0 B$ D% C1 ?; T2 e2 d. M

7 t; r4 }* e4 k# K( O( M5 z
8 n6 j  Z7 V6 t7 j( X  s0 A////下面不需改变////////////% _. k5 w0 O) ]$ i& [! A
& Z( A5 X' c9 |
var copyspeed=marqueespeed
! {- N" o* c% h% @var pausespeed=(pauseit==0)? copyspeed: 0
* Y  Q0 Z" U9 {& d8 L- K0 Mvar iedom=document.all||document.getElementById4 a7 h* f; o% J) R* i+ I8 L
if (iedom). L% Q9 z, L0 H9 K" G# J& B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' i7 p  T8 I, K& |, G
var actualwidth=''% }" S# S9 R6 B) F, ^
var cross_marquee, ns_marquee
2 D- g, a  [% R8 O% p" F1 r) t* J9 i# @& ^, K+ P# I! [6 W/ M
function populate(){
" Z2 q  l3 y) A& A6 X8 x8 jif (iedom){
  X7 X$ k( N. c$ k+ t4 dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& A! a) b8 y: f$ q" M& D4 dcross_marquee.style.left=marqueewidth+8* O/ v8 t: G* v  V* X' n
cross_marquee.innerHTML=marqueecontent" e2 [! k& o  p' Z  K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: Y, N# E7 p# v. \* ]' r}
* ]/ n3 o+ p. selse if (document.layers){
$ ]% r) ~0 x) j3 h. u3 Qns_marquee=document.ns_marquee.document.ns_marquee29 a, L. W6 E$ t2 N8 z' k7 R+ G: o
ns_marquee.left=marqueewidth+8$ U1 g/ `/ L4 d
ns_marquee.document.write(marqueecontent)* R8 [( f4 R9 n: V7 {4 t
ns_marquee.document.close()
8 @! Q. I) j, ~: p( Y: Eactualwidth=ns_marquee.document.width( ]6 b  L7 d, \$ z* G4 v/ |9 U8 h
}
/ W4 r- g& n) ^lefttime=setInterval("scrollmarquee()",20)' J/ u* H3 P% y9 l4 L. j, P
}# A5 r" G+ x& T
window.onload=populate
% O1 D& a3 }5 e/ l% A) ~- N4 o( L! l! I2 W! X
function scrollmarquee(){1 L' x9 ^7 j2 g2 s$ T) H& S% T
if (iedom){
# H7 i3 r  X- F( G3 |, G2 R* |) Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 k4 o# E: K+ `. u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 Q, {  {- V* ^/ |. W/ b: e2 @else
& w. I& z% X; E! T4 @9 ?% B7 `cross_marquee.style.left=marqueewidth+8
& e* O- b2 G" n8 ]6 S  [
% ?( q# N9 H0 H" O1 J}
. `; q2 k- v, [* E; Ielse if (document.layers){/ A$ W/ J/ h! |; M
if (ns_marquee.left>(actualwidth*(-1)+8))
3 `! W2 v% m7 `( b8 X2 ]; Jns_marquee.left-=copyspeed
* b% |% t3 t5 J" ], i0 Uelse
. F0 B& u, L' r) s$ ~ns_marquee.left=marqueewidth+8* a' p$ E# O. s" b: n7 p
}
8 A" h' L' W1 X# l; E5 H; S" B' x) H# @}7 l: ?% q4 ]* |- M) ~, D
3 R7 y2 y1 L8 d& k' t, s# Q
if (iedom||document.layers){
% g$ ~1 i! J# K! k  ]6 M! H1 ywith (document){
; @* F( S9 W  e2 u  I2 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 U& w4 B% Y0 x6 }+ q) h7 g9 Lif (iedom){
  R2 e% x/ C& z) `% W# ?5 |3 Z$ qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 O) k0 ~/ E; b2 X1 }! P2 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 j3 E- t9 e0 [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 _; b$ w* e; v9 {: lwrite('</div>'): D1 J; A  P" R4 n
}, u$ l! F  ]6 _9 ]! M7 g
else if (document.layers){
7 C0 I: h) p6 _. r+ K* R* k' Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 F: l  b8 o- x7 G+ W' a" x# M* P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): z4 j- a' X. _" C
write('</ilayer>')! o  o& K; _5 x' i
}8 |3 C' e( c5 x
document.write('</td></table>')# N2 n3 A% f% I9 v4 G2 _' E
}, M0 ^5 I' {/ I. V+ r
}
7 G7 q4 [$ ~% A$ K5 G</script>

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