Board logo

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

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

//修改宽度( Q0 i% S/ J- Q1 U- T' R1 ^  o
var marqueewidth=300
$ f3 s4 P3 q, B1 z: @% b) x; F1 O//高度- F; N0 x4 V+ [9 G' h
var marqueeheight=25
/ K8 t9 M7 k1 f1 p( Y7 A//速度(1-10)0 C/ p0 E9 H. N* }2 q3 Y
var marqueespeed=3
; K1 C" C/ ?: `1 }9 ?//背景颜色1 m2 `/ B' S9 D% A8 p: b' l
var marqueebgcolor="#FFFFFF"
% f2 \# S: O/ Y3 c5 G0 g  B//是否能暂停 (0=no. 1=yes)?
. m$ ]4 |  J# h9 Wvar pauseit=1
" U0 d- S% `9 U' `
" }7 e* R8 T5 Z+ a% Y//修改显示内容& p' r# a  t: U5 b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 ]5 W# X5 c6 C# c% P
# R8 f+ m* }  u9 o7 C
0 i- A9 ?2 J: A5 {" C( M: W////下面不需改变////////////
# F& r, j5 W8 C: U* J! B5 I8 R# D' X# w% \
var copyspeed=marqueespeed
# ]4 O: ?$ C& q8 O' kvar pausespeed=(pauseit==0)? copyspeed: 0
4 l  K$ S4 I, i- D4 |) Zvar iedom=document.all||document.getElementById  j4 e5 v6 h- L) W2 k/ y, o
if (iedom)
/ G% m4 n$ X$ X7 @* f& }1 y! F: |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* o5 w+ Y2 Z1 i3 n; r4 m) X
var actualwidth=''7 {( f# f( s& B+ `2 V3 m& s
var cross_marquee, ns_marquee
/ X0 M$ \+ y$ K- P
7 S! a$ w: h; i- C9 ^& D1 }1 sfunction populate(){4 G) B8 V: _9 f5 b8 {* M
if (iedom){
8 J+ e# C* P* |' l0 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, ]. N% V! t; k8 X; a/ vcross_marquee.style.left=marqueewidth+8* X* V2 N6 M' N2 _
cross_marquee.innerHTML=marqueecontent
: Z! m- g: x: w2 Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, S1 l1 j9 t8 x; F# v9 s% J
}. V2 u* Z5 R- \. d0 o
else if (document.layers){
( z4 S& n1 b& H  u' j, uns_marquee=document.ns_marquee.document.ns_marquee2
" @' y# T5 `! rns_marquee.left=marqueewidth+8
4 n9 g6 D& i/ v( ?  w) H4 s' c" O* Sns_marquee.document.write(marqueecontent)
& B  f+ q+ f, x; e0 K8 e: G- Rns_marquee.document.close()
# {. _- S; P6 O2 A* Jactualwidth=ns_marquee.document.width
' |8 `3 `, y2 x, y2 W0 K}
/ Z( C' M) O2 mlefttime=setInterval("scrollmarquee()",20)
1 z: e" s# ?, h- g/ X( r6 r* N}3 {+ j* Q7 R$ A  J
window.onload=populate
+ u' |' n6 ?. W) ^3 ]
$ h3 C! z; P* N, }! Afunction scrollmarquee(){
; ?/ u- E3 u$ `0 g; v( \* Rif (iedom){
9 I5 r7 O" r* m2 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& P9 D  X6 S7 Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) _/ |9 b, z' A' J! L$ L# g
else, s5 V: k. e% ~  }+ Q. |
cross_marquee.style.left=marqueewidth+83 O  ^+ W! L/ y3 c, w

- k  i* K) u2 L' K}# |+ l2 S4 f9 {6 z& T/ V
else if (document.layers){
/ u8 j6 K0 i; M/ y0 ~( Tif (ns_marquee.left>(actualwidth*(-1)+8))
# X  f+ A6 p. O, f. D+ o  ]6 uns_marquee.left-=copyspeed
+ W# P$ \' V8 U$ Zelse
" M2 P0 I  ~  s, Y; _, N- [# Yns_marquee.left=marqueewidth+8
; ?1 W# D- s; X  F6 ?6 u}  \" g$ M$ J; A" {$ E4 `
}
6 p9 `: q  p) @% K/ \
8 U5 f2 l" `$ Q/ c& wif (iedom||document.layers){
6 ]6 C7 h. N1 ?/ w# K/ Owith (document){
. w& a; L% A; y9 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 n5 C. j# A7 \if (iedom){
$ O/ |+ A5 D0 m7 Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* y. S4 q; r0 P2 D( ?# t# Q4 \# dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 u6 C' ^) k& @& M* C+ Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 C- u" I1 a% j9 F( w
write('</div>')0 ~  m4 }1 Y2 u+ f
}
1 `; [" j/ l' O# q+ T1 B( Nelse if (document.layers){
: b+ r  L) z; d3 ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). O* `/ a  X5 G2 G4 Z5 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  u& Y0 m6 z  L% s7 N% u, I% q+ swrite('</ilayer>')! ^3 @* w- A: J! Q! B9 M+ g+ e( U
}4 M; R3 C* I+ s$ o- s  z; }
document.write('</td></table>')6 B  j5 }, \8 z% Z2 p
}
) U% c5 E  u. d0 c9 h7 S}, j: {, h( c' U* {8 B8 h
</script>




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