返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 E# i: N1 ~8 v5 @( {5 I
var marqueewidth=300
! K6 V. r' q6 n( }  p7 @//高度
5 Z  t& {& p. M2 Y# Dvar marqueeheight=25
- G( q  \7 R' X, \4 ~% h/ z//速度(1-10)
+ ^# i% I6 m. Q# _! n" r3 d; Uvar marqueespeed=3
: l7 X% \' x! W% t" {8 f6 U//背景颜色) J+ w5 M8 Q/ r# _! X+ `/ O& R
var marqueebgcolor="#FFFFFF"
# Q, ]; m, Z' E//是否能暂停 (0=no. 1=yes)?$ m5 {3 C7 d, r+ s, ?  r
var pauseit=1& d- w- `( G5 E( V
* M, p% O6 \. w, P0 L
//修改显示内容
. f7 c7 F& F3 m. z5 f3 M. t* {; [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; ?+ a' D$ T/ s8 M! A0 n. I# |
& y) c- `: j6 C& G+ b
+ s/ O. i, T1 _; V8 L( U' H////下面不需改变////////////9 d$ o% @' V0 R( _2 J7 o
* @9 C) c) w0 A
var copyspeed=marqueespeed
' J0 V! C! @' Y0 w: {' B+ j% gvar pausespeed=(pauseit==0)? copyspeed: 0
7 I6 o4 `, ^+ svar iedom=document.all||document.getElementById9 e7 x( e0 L2 \, H
if (iedom)
1 W$ `9 E" E6 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% ^2 r# D6 K7 ^
var actualwidth=''9 q8 \: L9 X; |
var cross_marquee, ns_marquee
$ [& F, l9 v( M
0 a0 J+ w5 n( y5 J$ {function populate(){6 _) n6 l9 P# K+ p$ o2 R5 f
if (iedom){
+ _2 `. H1 q! ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ F4 C& S- m3 b" t: C5 ^" `+ p
cross_marquee.style.left=marqueewidth+8
# L  A. A/ Q" S2 B6 s2 Tcross_marquee.innerHTML=marqueecontent
# f0 E; J/ n  I( H& C9 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 l" K# B- D4 H5 c5 p}
/ r! A! i/ A& Celse if (document.layers){0 ?+ G) J5 ~( {, \  k  @. C4 }
ns_marquee=document.ns_marquee.document.ns_marquee2
2 J' r+ p4 l- Ins_marquee.left=marqueewidth+8
* O* ]1 z; {) W# [4 Zns_marquee.document.write(marqueecontent)
& a& `+ w  P) f. l: B, dns_marquee.document.close()- c! u$ z5 M9 g
actualwidth=ns_marquee.document.width; ~  L% y- ^5 u/ ~6 c! C! _- ?
}+ {: X& S) ~- I
lefttime=setInterval("scrollmarquee()",20)
" ^$ V: N6 [0 s0 |+ W- S3 q}
  t1 J+ I9 }* }window.onload=populate/ o2 R2 |2 S, R- v% M* K# d; K) ^
! |1 Q  c& e" f* i7 F6 A
function scrollmarquee(){
- A# w6 W* p& a5 @5 ~4 ?8 d& C, Kif (iedom){2 S( L1 S4 U: T* H! J5 I; k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 Z# Y- e8 o% f, H& |! L$ |5 L$ G2 y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. |- h! ?) }0 [5 s0 y" U2 _! b
else
4 ~+ ]; u  t5 D. v4 l# U( z! Ccross_marquee.style.left=marqueewidth+8, y$ ^/ v( H9 w' b4 [. f3 |8 u

8 i3 P( [4 U/ e* c6 _}
' O- j8 v  D) R! d+ }+ kelse if (document.layers){
2 b" F2 K) v1 L6 l; _' C6 j4 c$ Vif (ns_marquee.left>(actualwidth*(-1)+8))4 f: P4 g: T) g5 K
ns_marquee.left-=copyspeed: p8 G# @- {. s7 q* b$ U2 i- d
else
# u2 G+ ]. M3 i2 K9 O: M# c5 U, @ns_marquee.left=marqueewidth+8! N( b5 [2 ^3 _& T
}4 @. [7 R. j$ s; ^
}) P  `5 _* o) \
% S. h, |/ Q9 w
if (iedom||document.layers){
9 I5 r5 S& ~+ T0 u7 \3 Jwith (document){$ [5 O. e: V( o) T4 z/ N5 T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* |2 I! [2 g0 O. ?  f& Sif (iedom){
- M, f5 F  ?1 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): i! I6 _4 ^7 x3 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! B0 p+ B, J0 d4 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): I: D  P$ u  O
write('</div>')- F6 i5 k/ Q. n5 W  s
}9 E* o  L: A6 u* n6 Y- Z
else if (document.layers){- h/ |( S9 j# Q" b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  j- k2 x9 o. m  v5 {5 ]/ W( \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 i8 [0 I$ n% `write('</ilayer>')/ I+ X6 `. M# x" L4 }- c
}
( p0 |8 E% f9 s" R- xdocument.write('</td></table>')1 E/ H6 b7 E: r! U4 i/ |
}
3 |; L2 }; w0 z3 z  k6 N7 P. t}( Z% J! T1 h+ I+ ?) [7 F' o+ D
</script>

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