Board logo

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

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

//修改宽度+ }' q# w0 [; H
var marqueewidth=300
4 |. j1 ^: c# c! e/ D6 `) F//高度( C0 @8 M& X5 L9 d3 B# \
var marqueeheight=25
4 C7 l$ ^  G/ i//速度(1-10)
5 I+ T) ]* b; ^3 T& Jvar marqueespeed=3
5 R& g+ i0 H1 C//背景颜色9 c# |1 K3 \: H: y
var marqueebgcolor="#FFFFFF". O8 P; h6 I( R+ o
//是否能暂停 (0=no. 1=yes)?
1 X0 _, c+ N2 B' Yvar pauseit=1
# N8 C0 e! U$ ?+ F( u0 s2 r
1 ^9 n1 }. a, C# ?4 W/ v//修改显示内容
( V; k# p/ K2 u( r7 _7 i2 U# E6 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' i' _7 v9 z6 i: q) @3 x$ X

$ f7 q4 O% y8 ~7 E
& @: K) g, g" N/ n////下面不需改变////////////
( w2 n* Y+ j+ @  a6 c, r8 \
( y$ M* T$ t9 J8 }* [$ E& Bvar copyspeed=marqueespeed
/ \8 w6 P" |, F6 h/ A! Lvar pausespeed=(pauseit==0)? copyspeed: 0
5 q% E$ H( o& a( f6 _5 b6 H3 Bvar iedom=document.all||document.getElementById" g- X# D; {- [% S! n
if (iedom)
. H6 Q; m) l; R. Y/ }* e. sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) u$ Y$ ]. c% {# w4 |3 O) mvar actualwidth=''
  E" x; P9 N: `1 u5 @" Uvar cross_marquee, ns_marquee9 z/ T! W* H6 }9 i- y- r8 L* h# R
% s6 X7 R! ~- c
function populate(){
2 J7 [2 D, r% R  m7 `0 K0 j1 M( C  zif (iedom){
. O& d- n( b0 E$ V6 z4 E# M: Z/ x  ?; lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) ~5 c) s/ u& Q2 U, z: _9 a
cross_marquee.style.left=marqueewidth+8
5 h" \) ~) @: wcross_marquee.innerHTML=marqueecontent
; J, s# [- ~: H- K; s# Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" K) e3 Z1 v  k% A1 s% }}; l) `" K( u- z( v
else if (document.layers){# f6 a' _: a, `) v" _  o
ns_marquee=document.ns_marquee.document.ns_marquee2+ n( X7 N9 n' R% D! n* V# [( m
ns_marquee.left=marqueewidth+8' f/ G. F5 r# P
ns_marquee.document.write(marqueecontent)7 r$ t( {; g8 `+ M* m7 G
ns_marquee.document.close()3 O# U  B6 x& e: f0 Z! a$ K, |
actualwidth=ns_marquee.document.width5 m) L. `$ D2 V7 _! ]; u" Z
}  m% G, p. b2 I3 S6 h/ w& B: d, t) b
lefttime=setInterval("scrollmarquee()",20)
8 [2 d4 ^& d3 F, }5 X}+ I6 T9 U  B- v3 Q+ {% \9 H/ u: R
window.onload=populate
( W. y- p2 w2 `! m% m
/ R$ [0 P6 L; q4 s/ `# a% qfunction scrollmarquee(){' j- E7 D# X) e6 N$ E
if (iedom){
3 a9 U9 s6 {, m1 [' M2 K# nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 m2 r1 ~7 a. N( x" _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 }% r/ W. L  z9 Oelse
9 J! I4 `) D% T/ Ycross_marquee.style.left=marqueewidth+8* z- _" e# Y' y6 R
( {8 S/ j4 E6 n/ ^/ F
}
2 v+ h, V# Q* E  D0 a# relse if (document.layers){( z% u# I( g, K5 w" k8 M, k
if (ns_marquee.left>(actualwidth*(-1)+8))
+ l9 P5 J& C1 q  E7 Fns_marquee.left-=copyspeed* e# t7 T. X7 N( ~( F
else
' W6 [. I, i% W! r( y' \! ?6 Fns_marquee.left=marqueewidth+89 ~0 |' T- a) R3 `: L/ q
}
$ ?' K* m; A2 T5 @# q}
$ t! p  D* k1 P" b) a
- M; a" U+ [7 Z2 x/ n( Y- bif (iedom||document.layers){% L5 ]' R- x5 X6 c' b, r
with (document){
/ U2 Q! f: Q8 Z. b/ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 ~, \( r+ ]  t& v& [if (iedom){
4 u+ ?+ b+ c% R8 a& E% h& s. |. l1 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# M& K( Z  ^; [5 q5 O3 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 }3 ~1 J7 p. z, V4 K; Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ Z: r) B$ y& |( s/ [  P. M
write('</div>')
. Y) @0 T0 h5 H5 Q& q}4 V. L: p- ^. j) k, i
else if (document.layers){) s4 \; R, F6 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( N" ~+ J  r- t: [1 {6 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  _; l, q+ [/ M3 J+ k. ywrite('</ilayer>')' i' J  J8 V! ~: V
}8 M1 O2 o2 S# Y9 f0 y
document.write('</td></table>')" D" Y2 o9 `# n' `8 f( e- \- H0 z
}
2 k% @$ p7 r, {}
% r- A" e9 r. m" _8 o. ^! }</script>




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