返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 b9 v' H4 f0 V" M# ovar marqueewidth=300/ s" {. L2 U1 B- K9 _
//高度* T' i. \4 f% k+ E
var marqueeheight=25
- }- b: e7 ~9 A//速度(1-10)
. w( e; T4 @$ S8 @$ qvar marqueespeed=3
* H+ {) v+ k0 A  H) L4 O. q# p//背景颜色' r$ y0 a$ K) N
var marqueebgcolor="#FFFFFF"8 [6 a+ z, P7 Z- T
//是否能暂停 (0=no. 1=yes)?! D5 r3 g4 \" g" f0 V+ d
var pauseit=1
1 H. c- B! F! g9 H+ @
( }( }9 w5 r/ }9 @//修改显示内容
8 M! {0 c. {0 N8 r* dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 D0 n' f8 r8 w7 R% G9 [' Q
( z  Z  l: T1 I" [8 a6 x

, Q4 x7 j- R7 C9 W9 O3 r////下面不需改变////////////  h4 x6 ^* J+ D; |/ T! q

/ F# o6 _, t0 {3 `1 d& f# cvar copyspeed=marqueespeed( |3 y% Z8 y. P) W
var pausespeed=(pauseit==0)? copyspeed: 0* X, x( ^8 ], x- c$ D
var iedom=document.all||document.getElementById
9 v  ]" b5 u' t$ F/ r: f% Kif (iedom), s% `' I6 o& K% N, g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; N: l6 B+ _( t; W/ a: ^8 b; s* c4 ivar actualwidth=''
3 [/ c: \) \1 M  v- x) rvar cross_marquee, ns_marquee
7 J9 k$ e- Z) c/ R4 [) _) m5 W$ R! k8 h8 k4 k0 D" _( P
function populate(){
; n# ?7 K) x! p6 R, n' _. Aif (iedom){: a- ?* K+ J# _/ c( }( m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* N1 Y3 `7 n2 P+ g& z5 F* Q( k
cross_marquee.style.left=marqueewidth+8: i3 n. T" ]; ]0 b- f' R
cross_marquee.innerHTML=marqueecontent7 j- t% p5 X; @! @1 G7 y  E2 Q: S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 g( _6 A8 @. Y$ A6 e& R9 c5 g* E}
5 c3 I! v& o+ f; I  a& ~# V2 y# \else if (document.layers){6 o( h" n, @# H2 A
ns_marquee=document.ns_marquee.document.ns_marquee2
" I, u% u! u8 n# q4 rns_marquee.left=marqueewidth+8, S8 r1 w. n0 C+ u: u& _0 K
ns_marquee.document.write(marqueecontent)- m+ @6 p: t5 l
ns_marquee.document.close()
  ~8 g' J! }1 h2 aactualwidth=ns_marquee.document.width
! H- \# X: w) E* d! }# ?}! A' O0 u# I2 n8 [
lefttime=setInterval("scrollmarquee()",20)& s$ f+ _7 Y8 g) H* U
}! f+ y, ~' W% `& {
window.onload=populate* g+ W' S% n7 x! x% v% ~, t

! [. f2 T; q- t5 r) n/ {! Zfunction scrollmarquee(){
4 H5 v2 r7 T2 a$ Q; O' Jif (iedom){
# i; m2 }$ t  U% l. Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& m& ^0 ~( [5 M+ Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ g  }( v7 S' Jelse) g% ?. h/ c$ {, M9 {, d% j
cross_marquee.style.left=marqueewidth+8$ v) s7 I6 q  {! @7 M7 t/ C

) f; z; o) l7 o' M* j' N}
/ d- k3 ?/ S0 u( ]8 M5 Telse if (document.layers){
7 ?" V. W. |6 X9 W" oif (ns_marquee.left>(actualwidth*(-1)+8))
6 s! y8 A; ?9 K- M' x$ Qns_marquee.left-=copyspeed0 r+ h+ e+ i; V* O" j1 Q2 l: h
else8 ]2 M7 ^% H( A0 X% T" c
ns_marquee.left=marqueewidth+8
+ f8 Y" i/ I" C7 s& K; v}
' G, U4 i2 K5 G# P7 j: d8 }}' o. _4 e8 k  ~' x- ]5 ]3 i8 Z
* `$ d5 P2 o! d
if (iedom||document.layers){
  b+ v8 P  E! j% w5 J3 Ywith (document){
6 t3 k, w- H0 d5 a7 a9 xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! N# f. k; ]1 t8 C% {  Gif (iedom){
* J  t' e" m" f0 [& p5 G3 c3 ?* ~3 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* z, y( {$ Q0 q' Q+ ~* |0 Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 @: V; x) h+ ]6 s# u+ _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. z# J: ^, X$ ^write('</div>')2 B" N# j! N# o" D/ J3 [
}- f) B: x6 S! a, d/ a4 @
else if (document.layers){
! m/ ?% T9 \; Y1 c, qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: P! V0 C2 b! G$ i8 D* M# twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 [4 ]5 ?6 P" g$ z/ J
write('</ilayer>')/ D6 V* W5 I0 g7 K
}; q' @' ^1 e$ c, _0 ?4 h# `) d
document.write('</td></table>')
/ s; R3 o0 z2 Y  O. O, g+ `, L}4 @+ `! J6 x0 b  g$ X( U
}& [2 N4 j7 v  u( j9 w
</script>

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