Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
* g# n/ A( f8 `% Q9 |4 C9 Hvar marqueewidth=300
+ r& t( W& T: Z3 g& I$ y; q2 _3 v//高度
: y, U; ~! f  R( W, b7 Uvar marqueeheight=253 i& @! a# w! r5 ?
//速度(1-10)
# D5 p+ |* j) K8 i  dvar marqueespeed=33 F/ W1 d8 o% Q9 _# U
//背景颜色5 F: l- q. m' b4 d  Z5 A
var marqueebgcolor="#FFFFFF"
/ g; j, m  ~5 m1 M//是否能暂停 (0=no. 1=yes)?
* F( `/ M1 m4 h" h, t: o" R3 Qvar pauseit=11 O" k- F6 _# S  y- b/ P; e

1 Q: J' I8 c, b: V9 k//修改显示内容2 o4 \- q+ L0 G  p% v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 R  c# R& X, G  y. U% x
% y2 K  f# [+ J: L) R* \$ W7 N
" d9 x" |) C* r9 x+ d) |' J3 q
////下面不需改变////////////- r- w7 S+ H; m8 x

4 E& b* b- U  X. z2 j7 |var copyspeed=marqueespeed
6 A, m8 j5 c9 c: a5 f3 n, I8 Gvar pausespeed=(pauseit==0)? copyspeed: 06 O) C. L2 E$ D% @! e9 ^
var iedom=document.all||document.getElementById8 B: X8 a8 [5 q: z' o+ D
if (iedom)
: F/ N, ]4 @) z# G5 sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) ]6 B' B# b1 ?* H
var actualwidth=''
( W+ u  _6 ?  Svar cross_marquee, ns_marquee3 s5 T  S7 @# ]+ t9 i
, K3 \9 N' x4 W: @  B/ q1 D1 {
function populate(){
9 {3 L$ |. @/ U3 {  P$ ~if (iedom){
0 J" v. b9 D, H+ [: l" lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 w" [9 d$ }1 _+ wcross_marquee.style.left=marqueewidth+81 j$ x0 {5 O5 r
cross_marquee.innerHTML=marqueecontent/ I( ^' f- G+ K& q$ ]
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. D& u4 r$ g- o/ Z0 X) P% I8 |& j- U0 o
}
( ~4 g9 B, Z3 v* E( s3 felse if (document.layers){
0 L; z, g- F. Z* U- Vns_marquee=document.ns_marquee.document.ns_marquee25 ~  O, n3 h, K5 S/ J+ @7 s% w
ns_marquee.left=marqueewidth+87 ^3 l: h$ l5 ]* I  x
ns_marquee.document.write(marqueecontent)3 T+ V* F3 X  G- R- a( O
ns_marquee.document.close()* D- ?$ G3 A7 X, h# V7 Y) V% X/ q
actualwidth=ns_marquee.document.width
/ C8 R% v+ a! x" D}
' M5 q% }0 B# i: g/ Jlefttime=setInterval("scrollmarquee()",20)5 V/ z5 t9 t) c6 z: O6 J6 x, o. g
}* |* B0 X5 y! R  ^8 m# \+ O
window.onload=populate+ z. T+ J0 L/ u- V7 v9 Z( j' m
4 j' Q6 g( o' S
function scrollmarquee(){# a: C: h* F0 S; J1 Q2 c! l
if (iedom){
! @$ S- ^& E: O4 G. I! {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 B5 S2 A# G# V. P6 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ V( A8 P  Y5 X3 q. J
else
# R% R+ x2 j$ o6 h2 xcross_marquee.style.left=marqueewidth+8
. y, G+ r0 g; y& g0 G" n2 a/ |
& r* d7 [, \; `. a$ g; i}4 l/ k( O4 m* e# E& J
else if (document.layers){$ `- q: w, Y  l
if (ns_marquee.left>(actualwidth*(-1)+8))
6 Y0 H5 {, J, p; uns_marquee.left-=copyspeed
- k! @- |4 J1 S5 k0 C5 H. telse: t0 t0 ]+ N% O( s
ns_marquee.left=marqueewidth+8
7 U7 z& G0 g# }5 \/ X6 Z2 ^7 ]+ A- O}
( a/ v4 }& Q, h# W4 t0 p0 `}; D. R7 Y' N6 K

" Q# b( I( P+ k6 Nif (iedom||document.layers){. y% j, L2 e7 F" ?! b/ C7 h
with (document){
9 d! f# u( N2 x: C) ]  _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% O  ?+ f/ m9 A6 }+ T9 X
if (iedom){. ^" j) Z* j7 l! v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# K7 E0 k, b& f  L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( \' @2 K+ b1 d" I8 P6 B" K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). ~: \: Y: e2 \9 I8 a/ ]) J. u
write('</div>')- R" `$ H- L/ P' A
}
' Q( a7 ?( i4 |  B! ?# Velse if (document.layers){
# ~6 o. L0 [+ [: |7 c1 k4 T4 twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 R. U: k) v: C  |0 w8 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- S( W  n' W- w  Hwrite('</ilayer>'); X+ f$ S2 |, n, M8 ~2 d+ x
}3 o* J8 I* `& G7 N$ S& S
document.write('</td></table>')
. ]% x2 s9 _$ Q}
. Q8 g$ |! k/ o' }1 D}
2 P" Z4 @9 |9 l$ r$ l</script>




欢迎光临 捌玖网络工作室 (http://www.89w.org/) Powered by Discuz! 7.2