返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# T0 d. [3 u% t# E$ C! b8 L4 ]var marqueewidth=300
3 ^6 t$ f0 ~0 @/ F//高度$ p3 `& k, H( w
var marqueeheight=25
' L; d4 l5 {3 g//速度(1-10)
+ J3 z# T: R' w. X/ ?var marqueespeed=3
) {7 v' `: g7 y) i# O6 X//背景颜色
; \" y/ c9 _/ V2 }  l' Dvar marqueebgcolor="#FFFFFF"
8 @/ C* W* @! O8 D9 X4 L//是否能暂停 (0=no. 1=yes)?
7 h5 n% `5 R3 f5 |) s- `$ y7 a* t3 `var pauseit=1
' [" C& q8 O' |8 g2 ?! I3 ]* J: `& w* L/ o) N; Z
//修改显示内容8 x) F/ x9 N7 A! ], M0 h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# h+ U5 |+ Z7 W+ s0 B- G0 }& v" d

1 z1 ?5 t7 t- W( K) R, L5 [$ }, @2 \; }8 q
////下面不需改变////////////1 d" ^. l2 B! R: f

6 s$ `  d0 X' l8 [var copyspeed=marqueespeed* X# p. {0 ]- t: L5 c
var pausespeed=(pauseit==0)? copyspeed: 0( i; J( D: f- C) ^- W: f+ g
var iedom=document.all||document.getElementById& a$ ]7 W" P% p% |5 j' f7 ]' t+ s; b
if (iedom)1 f# c3 z! W! U7 x7 q$ }+ r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ k, P* T) N$ }* ^; c4 n8 _5 tvar actualwidth='', j9 D# x0 r) q
var cross_marquee, ns_marquee
4 z) p; [+ |8 p, v/ I
- @8 Z2 l8 y* c3 T; W* _6 V: c, Zfunction populate(){
$ q5 Y8 o9 _2 h, S: _5 R3 k; rif (iedom){
+ u' f2 `5 _& E9 p5 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. h- |+ f9 L  O- o9 Pcross_marquee.style.left=marqueewidth+8
( Z% x2 y/ B# h- N$ S0 i# kcross_marquee.innerHTML=marqueecontent
3 b& ]7 Z8 M# h1 {6 T" |# ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& K) {7 k4 ?; Y& h}+ T, v. E  T; {7 k+ l& w
else if (document.layers){
  I# w5 {. e* u' |, e2 r+ ?ns_marquee=document.ns_marquee.document.ns_marquee2
1 s, l$ u2 e% x; z0 m) g# U7 Wns_marquee.left=marqueewidth+8
8 e2 q' F% J- ]9 ]: Gns_marquee.document.write(marqueecontent)
6 N0 I; H% I6 Mns_marquee.document.close()' W1 X: {6 p5 Z! W/ p6 h3 ]
actualwidth=ns_marquee.document.width
+ x$ _3 ]" n+ C}. a2 s/ t6 Z4 v9 I: c. ?
lefttime=setInterval("scrollmarquee()",20)
  F, e$ V* ]" ^}; a0 W. x, ~  M/ v( {
window.onload=populate5 V2 N  O& }7 e+ z3 U4 C6 Q

; Q9 F8 R) R/ k/ O" Vfunction scrollmarquee(){& g2 ?. T% ]8 q/ t: ~! p: Z% i  R9 u
if (iedom){
2 ]/ Y& S0 J, p$ u% r: ]/ tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 S1 j; `8 t9 }5 P% Z1 X# S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. q; W$ ]1 F% A' [! u1 Pelse
5 \( @: r4 ]$ U6 [8 F! @cross_marquee.style.left=marqueewidth+8% G  F! D1 j/ Y+ l/ R0 M

4 m% a4 s8 ?, E: x0 @$ t* g( t}
3 z5 d( K& X# [) q. lelse if (document.layers){
1 Y+ L4 r* O( I% `! hif (ns_marquee.left>(actualwidth*(-1)+8))
! t! A# s0 b6 F( Ons_marquee.left-=copyspeed% P9 w0 O4 v& y) o* B5 S
else; ~5 O- M0 g- Z# j
ns_marquee.left=marqueewidth+8
, ~& ~5 V! O) u% }. L% N% y9 f% {}, S) F- Y4 g+ K" }  U
}+ l# P) `* T, c+ _# x

6 ^6 _5 p6 U5 L( e$ f; T; u9 ?if (iedom||document.layers){
) U/ R9 ^1 v$ Uwith (document){5 k9 Q6 V5 Q' M9 X. ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 V# q. Q  [, f. V
if (iedom){4 h9 d2 ^: o6 d/ A7 T/ H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 ^$ H" M. ?% k/ V( q3 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). T, |6 r& G6 Q; H' v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, y' q, Y$ q. b$ W3 t5 P& i, ~$ lwrite('</div>')
) W$ l5 X8 w4 g3 b' H, ?}
5 h  L; V& S+ ~2 g$ @& v: celse if (document.layers){
& u! e: G% C- \" v+ H# s7 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 q$ w3 M9 u7 ]3 W2 a6 _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% b- Z0 h0 [' L" f
write('</ilayer>')/ E) ?6 V) ~! ?, E; v3 q' v
}" W+ l7 a: c* @2 l9 |
document.write('</td></table>'): p* s& g0 x( V9 q
}5 f$ X7 \2 r' d: G" j
}7 F7 n4 _/ H; x
</script>

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