Board logo

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

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

//修改宽度8 u. n( ~+ B6 h, d- T$ P7 T3 j2 [. {
var marqueewidth=300
: Z" q) P0 Z7 r: }! a//高度
4 Z# O* F0 _+ ~( V* @9 avar marqueeheight=253 ~. n+ u$ k2 n% |6 j
//速度(1-10)
+ B9 j, v$ r$ [8 T  ~$ a# j: M5 L8 svar marqueespeed=3
% }3 M6 W# l( V- _5 _1 _& T5 z! `# Q//背景颜色
1 I# m6 M' S, Q' @5 Bvar marqueebgcolor="#FFFFFF"
  d- ?1 n6 q- u# e//是否能暂停 (0=no. 1=yes)?
! W3 O% R. D: {6 {var pauseit=1
, E& ^  v1 k# m+ E( ?7 [
3 f' v* _' o3 _4 K5 A2 V; \//修改显示内容
' k3 z" |% L/ m8 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, \8 Q" h: D2 i* D' r$ a4 g4 H) y5 p
' |& F2 L& [! e6 j# ~9 V
////下面不需改变////////////, B) c, e8 F. {  s+ P3 m: \: u
* ^$ D" C7 \; j4 f7 g. t
var copyspeed=marqueespeed
2 m+ F! C5 t6 e' s; Jvar pausespeed=(pauseit==0)? copyspeed: 0
  L4 T2 b0 T, u; J" w4 bvar iedom=document.all||document.getElementById$ T7 }7 W2 {% w; V
if (iedom)
/ ?$ M( _& Q: i5 W7 a5 c1 c9 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' {# X6 ]5 j( e: h9 c& Z
var actualwidth=''5 O9 s; c2 }: [& P/ x: m
var cross_marquee, ns_marquee
% K7 I2 @" k" g( q1 y1 [' E/ V
$ ~! @& _) L. P; Kfunction populate(){
  @8 R" S0 ?6 e8 C" [if (iedom){' ~8 `. g/ P" `: @5 j  @4 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% |& W  S1 W4 y' ~0 l2 X: `( [cross_marquee.style.left=marqueewidth+87 b" r' v  T6 L4 K
cross_marquee.innerHTML=marqueecontent
5 s  X/ {3 d& p! m6 j( g, Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 v9 ^" B( _  y( E$ |3 t+ ]7 i# j
}
- h# L" U7 |3 l3 |4 {) p5 T1 s4 Jelse if (document.layers){* t- F* I% o* G) q$ \  B
ns_marquee=document.ns_marquee.document.ns_marquee2
6 P  T7 g. o4 H1 O; E2 B5 _ns_marquee.left=marqueewidth+8
( W  _4 j6 l$ U. r. i; a# sns_marquee.document.write(marqueecontent)
! @7 ~( X  x3 [- Z2 G/ wns_marquee.document.close()
0 f2 s# c: N  g( t& U& ~" d4 d9 Aactualwidth=ns_marquee.document.width
! W6 g7 z) ^  Z+ g2 a}
) \4 V: ^* G0 B+ N( blefttime=setInterval("scrollmarquee()",20)! w. j" l) `& W4 e4 r+ l/ k7 M- M# U
}
+ }; r2 N' g0 d4 J4 Ywindow.onload=populate, r$ i. G/ K8 e
0 H+ X7 m. \8 m- C3 M8 `
function scrollmarquee(){
7 v9 z9 Z; A$ t" xif (iedom){
+ o, h' B+ k6 k* ^, h+ M3 L( j3 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 m+ {5 w$ V; a3 L2 B/ {% z# T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 o! t9 x) l9 G2 [% O) d, y) k" @1 b9 l
else6 o9 _7 ~4 H5 b6 T7 h" o
cross_marquee.style.left=marqueewidth+8
3 T5 ]2 f8 t' x
9 x3 ~8 ?* W3 w6 y+ u& \}& t1 _' W- X& ?" i# {* f7 `
else if (document.layers){7 y& L, \- @& v$ p+ B( M  N: @
if (ns_marquee.left>(actualwidth*(-1)+8))# T; Q* V! }2 M0 C; @% q' d
ns_marquee.left-=copyspeed* E( a1 C: _1 G2 o9 H1 d
else: x( {$ f, T; N
ns_marquee.left=marqueewidth+8
& L/ u. Q1 C* O5 }}
6 T! G/ ~+ Z! }}
) d  I8 F. b4 H7 |
4 m5 b5 [7 ]) ~8 f8 xif (iedom||document.layers){
' T2 y3 b) }' q* vwith (document){
0 F' a' A" g& H6 @  ]2 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ h# H2 s$ s1 p  Wif (iedom){
% k6 Z+ u* c$ ?  {: O# {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 y; R( F- G2 `) v9 Z/ Y( L* w7 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). d6 O2 y- M, d6 t5 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* S! P- G" ~- I: s+ b4 ~, @; J
write('</div>')
( U* Q# k* Z- t0 \1 S3 b  K}) `4 u, y# {% J2 `
else if (document.layers){4 s6 ^# Z& a3 ]! F4 w# G& B1 w6 w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 r: ^8 G# ?4 O, |& r. \0 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 Y# i9 L+ I" D8 u
write('</ilayer>')
, x3 j" N% ^& p}# A( |( Z. g# o7 ~/ ^0 D. \
document.write('</td></table>')
( H/ p2 B4 N8 D& O3 O}. s9 X; F* X, ?+ `) c
}$ r/ h% z( }$ C, G, O
</script>




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