返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' _1 P' S. m( P; Q. {' fvar marqueewidth=300
* l+ c3 t! S# {# U; Q- k//高度
- d6 k( Z' v, F! C4 o+ Hvar marqueeheight=251 q: U3 E5 ~( P) H: h& P# v, y
//速度(1-10)) }- G3 e6 b8 f" I9 g
var marqueespeed=3/ a" e. Y" y. c
//背景颜色& R2 ~2 c% q3 o, D- V& g& p2 l
var marqueebgcolor="#FFFFFF"
6 ^) e; X! A' e/ z& h//是否能暂停 (0=no. 1=yes)?
" q- w4 V/ y9 K* C" a1 _' R/ Evar pauseit=1
' w& `0 f" V2 o0 h/ F  a
' `5 n/ Y- ?( k6 H/ ~7 h//修改显示内容: l5 e. J- M/ v% e3 k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( A9 A1 B  g% v3 T
4 f' K6 w' H/ {+ N  n+ s1 k5 H

0 j7 Q; p8 X/ i: n2 V6 B% B////下面不需改变////////////
9 J( A9 m) L1 z* B- Z6 a3 M: A( z) c
var copyspeed=marqueespeed
6 Y: s+ h2 {7 X) F" ivar pausespeed=(pauseit==0)? copyspeed: 0
/ [3 q* z7 R/ Wvar iedom=document.all||document.getElementById
/ r: L# W1 h/ r. nif (iedom)
6 b- ^) w% L; L& vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. r/ W: J/ [% {6 Kvar actualwidth=''
8 i5 w# E# d2 Q$ a. k5 |# |* ~var cross_marquee, ns_marquee
+ y7 T8 G" s: S7 L3 _8 O; A
6 z7 \! }8 C; e1 T: O7 Jfunction populate(){
+ C+ [6 x8 k, R% g# yif (iedom){0 k6 @$ e, C+ R  g  {' T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ b3 _& l( S' b1 G
cross_marquee.style.left=marqueewidth+8* L/ n7 w* j& L4 F/ f+ u# E5 Z
cross_marquee.innerHTML=marqueecontent( T$ F* z2 C) r  y3 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- A4 \  W7 ?* A8 j0 z* g}
9 f' N0 J+ A5 l  H3 ~else if (document.layers){
6 q3 X9 \2 o/ `) H& ~* xns_marquee=document.ns_marquee.document.ns_marquee2' ]3 _  I% q! J8 b1 M* N. o8 {4 }# T
ns_marquee.left=marqueewidth+8' g" s! S2 w  i8 G) Y
ns_marquee.document.write(marqueecontent)
1 M- W( S" U) o: p8 q: jns_marquee.document.close()
, b( z" ~8 b. kactualwidth=ns_marquee.document.width
0 ?& F! B) R. Q5 t: L}8 Z5 T! u5 ?, i" g' W" g( D
lefttime=setInterval("scrollmarquee()",20)
. o+ }+ M( @, b# T( c}
' W8 b0 V4 v: y0 R/ L2 [# zwindow.onload=populate
$ @( c1 O$ X$ R* h: j- Y! Q
4 C5 }1 t$ {: p. Ffunction scrollmarquee(){
" Y( K. E2 d( ]/ {9 p) r+ gif (iedom){
! d# P6 }8 a, B/ o; ]: @; C3 n/ ^) b# Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* B4 x0 Y/ ]8 F- Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 A, h" E3 T9 H4 B# O
else
0 p6 j/ I! \3 @6 k1 g' z' Ncross_marquee.style.left=marqueewidth+8
  j) k, i/ o+ N+ ?) M7 Y
+ i/ V9 ]- P" V$ V}
) g# P8 k) d3 |/ }& zelse if (document.layers){
. ^) c  h! H/ i7 r( D1 L" B: U$ @6 _if (ns_marquee.left>(actualwidth*(-1)+8))
9 e& z7 x. N3 W) Yns_marquee.left-=copyspeed& h* l4 p% z* g
else
! A7 C# s2 e2 x# O% ]" V* A* Pns_marquee.left=marqueewidth+85 H# [! m1 t; @& x- q
}
; m, i( s6 N' [$ l! B2 k* |. }3 ]}7 O7 d3 z* \0 L# |

8 ~( t2 h" B' Z( _if (iedom||document.layers){& d5 Q4 k! G" }- `
with (document){* E* |4 u: I3 D$ p: Z' |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 ^! e' e( ~, a# aif (iedom){
$ ~- q" m8 b8 S( _  x& [" t# O" x' b* Y' zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 ~) g" F! I0 m$ |) a8 z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( a# D$ s5 x# T, k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! H' n0 ~/ ~2 `/ h
write('</div>')
, V* e- d. }+ `4 J- Q: A0 e}
. `* n8 Z' p' P2 W3 _. o" Melse if (document.layers){1 M; L9 R' @7 Z( o; J5 p+ c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; r9 c% _7 p  J$ m( _4 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! y9 U  v: f/ O0 A
write('</ilayer>')5 V: K. C7 }. y1 S  \
}
9 S$ j: e1 n& T. k* V1 W' fdocument.write('</td></table>')
, B' [8 R1 y) Y- |}
1 D1 ^/ f6 O' l2 c}2 k, b+ O- v! h% t9 H
</script>

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