Board logo

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

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

//修改宽度
- i% }9 c+ I1 g* pvar marqueewidth=300( g% ?5 j% b/ W! D. p+ ^
//高度! {3 X% ~* n8 L( h
var marqueeheight=25% }; U7 r' u' w2 ~8 Y; c9 {4 V3 x" |7 G! j
//速度(1-10)) J1 E2 C" ~' p0 M
var marqueespeed=3
, g. b# N2 T, X. M# d: t0 u//背景颜色% e0 d# D. K$ E/ J2 \  T& r
var marqueebgcolor="#FFFFFF"
2 @: w! c3 N, E3 c; ?4 P//是否能暂停 (0=no. 1=yes)?: [5 Z9 `7 l; N. e! h. {. j0 r. k
var pauseit=1
+ w4 z3 S* d6 V) n% p% a
8 n% e- k( i8 d7 x0 e  O, h/ U4 a//修改显示内容5 {3 t& y; x$ M; }) i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( e% ~- @/ S9 k" O" B, N
+ s% ?! ^& v  f( b9 k2 B# D. j
; W& V7 T0 }4 u/ @: E
////下面不需改变////////////
$ C  P+ M/ {% z0 q& y+ }* g) w: P. N" l; [- A1 d- D
var copyspeed=marqueespeed) R% \: r  ?/ I
var pausespeed=(pauseit==0)? copyspeed: 07 v( _4 L# E2 M9 v
var iedom=document.all||document.getElementById
3 z: X& j8 u& S3 a. B, H! rif (iedom)" q, @; ?+ g: y. J4 S$ |" W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ N: V- N; {8 J: N9 W0 h+ Evar actualwidth=''
0 B# V  r+ P% P; A$ G% P) mvar cross_marquee, ns_marquee
! i# y9 U& O" L( [0 Q' W# |9 J. [
/ h3 D$ d% T( X; Z  ]( Afunction populate(){
9 L9 ]% c2 ]) z7 F% Z* zif (iedom){$ C' S  Q( Q2 u6 P5 W6 G1 q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# o; ^3 a4 j9 h7 o; ^" o/ U, T7 `cross_marquee.style.left=marqueewidth+8
2 ?6 q6 F* n$ zcross_marquee.innerHTML=marqueecontent# V$ y8 K  j$ R. c% g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# x7 c1 L8 m( u' _
}4 y5 D1 o4 H  C9 Y. G, D, b2 f# U
else if (document.layers){
+ W- ]' {( n/ e& [/ i  m7 ]ns_marquee=document.ns_marquee.document.ns_marquee24 a5 U2 e1 r3 e$ P9 a, q
ns_marquee.left=marqueewidth+8
* a. Q8 F( R) E& l9 U6 Uns_marquee.document.write(marqueecontent)" f5 r1 W' E' Z0 W
ns_marquee.document.close()+ D( S4 q1 N: G2 |$ `- |3 |
actualwidth=ns_marquee.document.width
' z+ p8 ~9 G) g+ w3 v$ I}) m4 c& x9 l/ G
lefttime=setInterval("scrollmarquee()",20)
4 H% A2 y* C6 s% Z! ?}7 y$ ~) Z6 T: M9 X
window.onload=populate
5 W8 p' K* v& m: r; w, L6 B$ r6 u2 `
function scrollmarquee(){
4 r* n& k2 y" F& V+ x' xif (iedom){0 d0 X+ @' ~5 f: N; T9 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. b. y4 z# [! i$ b2 D* ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: P0 {7 D, ]$ Q$ n2 L# M  c/ l1 belse
8 j: u# E4 \3 ~  B' L3 C4 Qcross_marquee.style.left=marqueewidth+8- H+ L; N. t0 Q  h, D# O

0 U' o* d0 F) m6 G3 H& ~+ \}9 H: `% g* y' {
else if (document.layers){
- @; R: `; Z# m8 A/ Wif (ns_marquee.left>(actualwidth*(-1)+8))+ D$ d: M. H0 u2 Q
ns_marquee.left-=copyspeed; r' ^1 C! L, `2 O
else
: I6 ~* l7 j% y2 H( K# d( K: ons_marquee.left=marqueewidth+8% f  X4 K$ K+ t( Y$ f- A
}' [/ y4 r. T( V
}
  p3 X  U" I+ I6 E( P6 D' c
. j, F. e# l7 w- M, u4 bif (iedom||document.layers){
. X+ Y! d  Y- c( ]0 Xwith (document){# l' j" l* ]0 j2 W- C1 M3 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. u& g* l4 p  n. _5 G5 iif (iedom){+ L# F& s/ ?3 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: j) v% l3 f3 F% C% Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ H- C9 W) x$ j8 ]9 ]! j9 ]+ |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 h+ `" H* H2 I# D  Ewrite('</div>')
) [9 S$ f' m3 q: c2 p. e}
4 J8 u" s# J4 z# S$ {2 Velse if (document.layers){( `; o3 ~; i4 r/ _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( I! d0 x8 W* Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); M' w! Y4 K9 f, l+ z* V
write('</ilayer>')  l" Y+ S! w- x- ^3 i5 U* K
}
. k3 n$ u' {5 Q: f$ r; q$ Hdocument.write('</td></table>')
* c% E$ V( C- _}
& o: x7 C1 @( Y}
" N. p* M3 L3 ?1 k# i</script>




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