Board logo

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

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

//修改宽度
. c0 }1 Q- g* A0 X' `& q; S. @var marqueewidth=300
$ g; X6 k% y' w7 k//高度+ s( B, T3 l  j5 L* V! M) S* m
var marqueeheight=250 x0 J1 V$ ^( g# Z5 }- G; O- R6 P' i2 P
//速度(1-10)
/ K: U! r2 t9 yvar marqueespeed=3
$ o' P# u" N; c. \! E* C3 @//背景颜色
0 y* N  p/ j( p% ?9 I. lvar marqueebgcolor="#FFFFFF"( D1 W, P" @6 @8 u3 l) Z* W
//是否能暂停 (0=no. 1=yes)?
; b5 {! m2 T; W0 e1 f  E0 d. \* bvar pauseit=13 a0 w+ k4 r8 E- o
* P  r4 h2 q- L! D% K+ Y6 E
//修改显示内容
( \4 t4 z$ m* j6 }. |+ v" tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  t( k. m$ E6 U" K0 s! Y/ V) |) k  U# V0 ?, |
3 e/ G* _% _- A
////下面不需改变////////////' N! i  {% T4 z& p0 T2 G

8 x5 D6 O$ \& N5 j# D" D6 yvar copyspeed=marqueespeed6 h8 s4 [; s+ Y, x. i. `
var pausespeed=(pauseit==0)? copyspeed: 0
0 |# {  W* n. U' Tvar iedom=document.all||document.getElementById5 b7 }) m; i- C* B9 q, C+ o( f9 A
if (iedom)
* P: F+ w& O% I8 l# ]9 _( bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 q, k: E: m1 r* nvar actualwidth=''
/ ~' _" o* B5 X- Y" Kvar cross_marquee, ns_marquee
1 d2 `: J8 f! b- H. o* N
; u, n$ P& E8 }1 R8 Q7 Xfunction populate(){" `; g  O: @+ a3 Y
if (iedom){
- `* e: x7 F- K9 ~9 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" i7 t! S9 @, y% |- n; d3 C
cross_marquee.style.left=marqueewidth+8+ b" B! F+ Y* S+ u+ {$ ]2 y6 n
cross_marquee.innerHTML=marqueecontent! U5 m0 \+ ^5 B1 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: N! t; J* {9 q7 t& c}
) H$ G6 A: Z1 O1 S. o+ k8 o/ Eelse if (document.layers){
) f- q% H7 s% R3 d# }5 o$ Ans_marquee=document.ns_marquee.document.ns_marquee2
" M* H5 |( N5 b, i: t: n8 Uns_marquee.left=marqueewidth+8. b& m( d- U5 |# @: l. B& A
ns_marquee.document.write(marqueecontent); b* d) M# u& G
ns_marquee.document.close()  ?6 Q  S9 M  G9 }7 f: A; V7 ?+ e
actualwidth=ns_marquee.document.width
( }. K4 f5 ^% H: S}; Z/ t4 z  J9 m/ d3 L
lefttime=setInterval("scrollmarquee()",20)
- H+ \5 B6 a: r- \4 x}5 A* }2 S2 v& X' ^
window.onload=populate3 v6 u* w1 `1 D8 M  g" f: {

4 k" @  O! k9 F* J/ R3 P% Cfunction scrollmarquee(){- g- R5 ?* t4 ?5 g- J# d! Q; g) M
if (iedom){
9 ]. @% X% e6 y# p5 I  @& s8 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& h- b9 ]1 J# B! {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 R6 ]! F# g, B5 k0 t) Z- T, [
else! o0 K( W( q9 N: D- r- {+ U
cross_marquee.style.left=marqueewidth+8$ I" B& a4 U& X- U8 L$ L  q- ?
5 W0 Q+ i0 s6 d2 F9 G
}* P7 t0 [# i: x* X/ I; j
else if (document.layers){# i0 ^/ w0 D1 w
if (ns_marquee.left>(actualwidth*(-1)+8))
% Y, O6 t; y8 y$ X( `* P$ Cns_marquee.left-=copyspeed1 ^% R/ z# O& K, [. H
else- Q% ~7 ~1 @4 B% K) ~9 x
ns_marquee.left=marqueewidth+8
$ D0 y& D: N' L! U/ q) a, F$ h& Y: K% O}
5 ~" a2 k8 }: T) E9 l0 Q" @}  @- s$ W( ]& w& ~
0 ~+ \# o! w- O- |; C+ k& r4 M- R
if (iedom||document.layers){
7 B$ l! W  I- U, \4 D8 Awith (document){; I! c$ ^: J9 {( y; [8 I" P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& s& x. {6 h+ {& c: R; ?
if (iedom){
& ?) D! \% y7 E9 a7 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), p: u" h% v+ C; |$ b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. ?$ N$ X+ F# Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; }6 ?4 N5 _% A5 ~, G$ Z7 }: cwrite('</div>')  `; _( G  M1 K* p  ?0 x
}
" v" k3 m7 w6 r% A1 J" @( Nelse if (document.layers){
% w$ a, I( ~5 [, y1 R0 B( Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( o. a) r! k3 w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, \  L$ }( S9 Gwrite('</ilayer>')
) U# M9 N" n8 i}
$ A* O* X+ p. ~/ ]& |document.write('</td></table>')
" ?7 E7 {* e4 B& \}4 t5 ~' g: `, B- _! q
}
% @; G& J+ r9 I</script>




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