Board logo

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

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

//修改宽度
9 ^0 P/ ?6 X# bvar marqueewidth=300
; {' {# {2 K( h6 `5 m, Y) }//高度
% q6 n1 R& ~; Z' s6 P1 g$ ?var marqueeheight=250 {6 x# B6 g: {5 [+ N
//速度(1-10)5 i2 L# L/ O. \: ~, X/ m/ q
var marqueespeed=3
0 F, L/ H+ F/ I//背景颜色
& ~' P* W# m! D0 C' }- zvar marqueebgcolor="#FFFFFF"
2 X; ~2 b6 F$ Z$ ?& W, i: E' ^; o//是否能暂停 (0=no. 1=yes)?) N! W1 p: A" O# C
var pauseit=1, {6 c, W! D* k, v/ n

# ~2 x; i) ^5 i//修改显示内容
& e( s+ M5 Y6 W9 O" y0 r4 f% Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', [" O. K# X0 B  k

6 L/ ?* j9 p: @# u) y" Z6 L' }/ n( G( T% S- d( ^
////下面不需改变////////////
, S# C+ V+ J- v% Z0 X; M3 p! p6 \3 d7 N  Q% N7 N1 Q
var copyspeed=marqueespeed  F* m0 u* r. i7 [$ ~8 Z( l& A; e- Y
var pausespeed=(pauseit==0)? copyspeed: 0! d) u: o2 o1 L( s, q* h" }
var iedom=document.all||document.getElementById4 T5 l2 f; o5 T+ `0 C* B& h" F3 B
if (iedom)# z6 U# G; ^% {: g% |2 h! j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) O6 c2 g7 A$ u& [
var actualwidth=''+ Q* r8 K8 @# R0 p0 n" e1 b
var cross_marquee, ns_marquee
7 C7 P* I* R) z) h6 N! [6 f- w) R; {, d+ p2 e/ j; I3 Q& c
function populate(){
8 q/ |9 Q: @" D& Y# G8 ~if (iedom){
: m+ v: M/ _0 t- J- Z/ Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ h0 M% R. |. X4 _9 v2 g' Dcross_marquee.style.left=marqueewidth+8
2 N4 J5 C5 H$ V3 y9 t& X( mcross_marquee.innerHTML=marqueecontent( I5 K5 E% N/ C" B/ A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 u" D- y* X* D0 e& p
}- y3 P( {* x% W, J' k, o
else if (document.layers){
2 O+ k% I8 R. w' H; cns_marquee=document.ns_marquee.document.ns_marquee2* X& E1 W1 E2 m* _; S
ns_marquee.left=marqueewidth+8: t0 Z" f7 W: f5 C& J9 h
ns_marquee.document.write(marqueecontent)1 l/ c6 K) U8 u
ns_marquee.document.close()
0 ^; X2 y  P, b2 Z$ nactualwidth=ns_marquee.document.width9 v6 ^+ c  R0 h" t1 M/ @
}
0 b0 X! e' s$ u5 k5 B" O' x0 mlefttime=setInterval("scrollmarquee()",20)
5 e3 W1 l2 D$ d" f2 s: _/ a}& h' q& @: z+ i4 D5 P
window.onload=populate
- A; K6 G0 d: n) x$ G, y# ?( B+ y' R9 z! w# ?" i" _
function scrollmarquee(){3 Q0 ]$ i# E( R& h
if (iedom){
  v) `( k. m. Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% x' d3 g- [& i4 Q4 r1 n8 k* S+ m4 p# m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( i' {' _1 i$ S( Zelse) M7 M& Z8 |% Z; }
cross_marquee.style.left=marqueewidth+8
0 f9 i$ U1 q3 Y  R" Q
8 G( V0 E" ]9 v( f4 b# ?  [5 `}
* N* u! I8 f& M5 celse if (document.layers){) F2 @9 |  G' A0 q
if (ns_marquee.left>(actualwidth*(-1)+8))
( w3 R3 P/ k% U5 y/ U: mns_marquee.left-=copyspeed3 ?2 j; h4 y, o3 }' m# w
else% C3 _/ w# E/ V4 m. \
ns_marquee.left=marqueewidth+8# h8 e" N2 _) k6 U; G3 L6 d8 ~
}2 D. l) J0 f$ @# P9 p( z  E
}
, N" i: R' ~0 P' A7 p7 `. ?% g; N3 Q& z# W1 T) W- q
if (iedom||document.layers){+ ]" X( {( E6 ?$ h: \0 U
with (document){* d" A9 Y0 c$ p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& e) [' s5 U! J. H" Z( X
if (iedom){
8 N) V; y% k. j8 d+ W9 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 |5 N3 H9 X7 h9 E$ h% p; Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), ~" [& u# [: e% z! p% r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" \* h/ t; o  m8 g
write('</div>')4 u' P. ~! z( }$ V; g. t
}
6 P: j- x- D, ^' t# Helse if (document.layers){
1 x" q1 q5 _' |$ a3 twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 F0 }$ A9 A- v% k4 L! O' O: Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ {. a* a3 O% Z8 E- z# {write('</ilayer>')
7 y) V% l6 d+ l- i0 I2 i}! e0 W: ]7 K4 H2 p
document.write('</td></table>')
% n; R5 J% B4 Z! x  c# P}
3 z. B2 y6 w% U8 ]}9 j! ~. `+ d$ l+ u6 Y
</script>




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