返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 m# H" a; x9 b
var marqueewidth=300. U1 K! T  g- s, ]
//高度
! c2 ?6 ]+ {) v. k( avar marqueeheight=256 ~# S& Q  ^) w8 c  u
//速度(1-10)
+ B- B3 A/ r5 J6 \var marqueespeed=38 M. x7 P8 q( Q  h
//背景颜色
5 `; f" V0 D) R7 b2 \var marqueebgcolor="#FFFFFF"- O. `. K. m2 q, ~: `
//是否能暂停 (0=no. 1=yes)?$ I0 s" A) k8 R
var pauseit=1
- z4 G" b, y' r7 Y$ @* l5 o, k8 N% h6 \: g0 ?
//修改显示内容3 t) o4 r- U; q. F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', p2 w' r, V  [
* D0 T5 y+ Y0 e3 E2 X0 |/ J' Y

2 A) X9 G2 q* t# N. Y4 P////下面不需改变///////////// E/ l* }; Y8 i. d' c. Z* s

; a5 T$ N5 W" Z+ `: T, I; `var copyspeed=marqueespeed0 B, r1 N1 o1 a8 x. Y0 ^
var pausespeed=(pauseit==0)? copyspeed: 0
  `! ]0 H8 E6 f3 C. l8 xvar iedom=document.all||document.getElementById
& @, o  L" n3 J8 d) A9 g; z$ ~; rif (iedom)- d$ ]7 Q" l. T3 B1 L1 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. u* c5 B0 L0 s. U" U. mvar actualwidth=''1 E5 d* P  V; i, W- x' j+ ^
var cross_marquee, ns_marquee9 g  D1 [9 X2 x  |0 Z9 x# S

$ C5 o" j: c  b6 Nfunction populate(){, [; l2 {- h/ ]& X- Y
if (iedom){- [2 N( G& i! U. n2 O4 M: ]( u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( I2 W" K- J4 x, F: c! y) |cross_marquee.style.left=marqueewidth+8
4 Q$ M. e6 O1 l$ A& ucross_marquee.innerHTML=marqueecontent
4 x( m1 \1 C) \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 A' h, Z2 x' o$ m, p}
6 \, d- S  ]! w. @- m$ P7 b! {, Oelse if (document.layers){
3 V/ v! ]/ G" B0 m: kns_marquee=document.ns_marquee.document.ns_marquee27 c2 C* @: p. ~* D7 |
ns_marquee.left=marqueewidth+8
3 O  M# l5 ~7 Sns_marquee.document.write(marqueecontent)! F+ l- ~3 Q& Y  E: @' h
ns_marquee.document.close()4 e6 u0 c3 Y1 r0 w2 `
actualwidth=ns_marquee.document.width' p% a9 h0 O4 H' Y, q8 R" o
}* }) C' S: U# ]; u+ R: v7 o4 q, d8 d
lefttime=setInterval("scrollmarquee()",20). k+ j& g5 P4 g- r
}
- [7 x0 v5 j+ R. ?, i( w9 vwindow.onload=populate
9 p. w9 D5 X" _
, t& `  E& r* _: efunction scrollmarquee(){
0 Q$ C. Y. L) ?* q* S- t- }1 Jif (iedom){/ y8 F- W) `; {- B. J* h1 ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( j6 B& }; s' K0 F. u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 M0 o& H- s3 Q5 D$ {else
, C- T2 D5 F1 gcross_marquee.style.left=marqueewidth+8
; Y8 ~0 |2 P* j; T" c
& N2 x5 d7 L& \6 ~( P}
! x! Q( L( \1 p+ h1 Q5 D, aelse if (document.layers){
5 G; s' w# m4 h1 _, g" Tif (ns_marquee.left>(actualwidth*(-1)+8))
. P+ T, _+ I5 U2 `# q- Zns_marquee.left-=copyspeed7 g9 z8 G- ?: r( J( `$ [
else
4 c. ?" S: j5 |6 k, G  tns_marquee.left=marqueewidth+8
( D/ t; b+ ?( a& C% Q- c1 p}+ o2 \0 o  w. ?- y* {* g6 f; T
}4 P' a0 d4 k9 u/ u" K

) [* i  o8 s0 {- Mif (iedom||document.layers){5 ^: V4 e! \2 {
with (document){0 c# f* e% w! F4 v, y' p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 |: ]% Q! p+ T6 U; q2 Iif (iedom){$ N' K# p# w- J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* H7 j: Q0 `3 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- P5 h2 e" `7 K4 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 ]( g8 W) p7 o$ Y
write('</div>')& K+ M* v- V+ B) p+ K, y
}5 g6 M8 {: a# M& ~$ @5 i' H
else if (document.layers){5 c5 n) y  K$ X+ P; C' U8 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& o. r1 X* q) d4 L1 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* r% k6 ]* L7 ?& Y( d: X' B
write('</ilayer>')
. ^1 d& h# h$ @7 q! D7 s- s& F}! j- \. e6 g- m" U) u) J
document.write('</td></table>')
4 _& g" z; c( o4 U# P}9 N+ F. B0 m) D0 R
}
+ o) T; ^! |$ w$ m* H- `& Y</script>

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