Board logo

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

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

//修改宽度
9 Q/ G9 y$ h- }5 Zvar marqueewidth=300
6 {8 ~4 _* f) C$ Z//高度! z$ V2 G8 L. ^$ ^: L. }  w
var marqueeheight=25* u+ Y; v$ Y* T) @% s" Z- `
//速度(1-10)/ r9 q, K1 C6 b, M+ T
var marqueespeed=3- d5 i# p, Q4 ]  E, e+ z4 O$ U
//背景颜色5 U0 o( I/ f/ i8 ^% I+ Y
var marqueebgcolor="#FFFFFF"
. T* o0 U; n2 A- e/ B0 T//是否能暂停 (0=no. 1=yes)?
* \: t2 q' f- y/ ?& }# ~var pauseit=1
$ Q6 w, ^8 }, u) f. h
! E' s( @- u+ X6 A" J//修改显示内容
4 Z3 g6 \, g; Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' ?" m3 u$ P& ~& F) o/ N

8 N2 [/ f) Q1 I) J; W3 Z! j* Z( L8 Z4 b+ g: ~! v# a7 G& s1 f
////下面不需改变////////////; e4 }1 f& T2 c' _6 d  W5 B5 b0 n+ p
& k2 G8 h) D3 s$ d
var copyspeed=marqueespeed: ~7 y' ?* L1 v' |
var pausespeed=(pauseit==0)? copyspeed: 04 z! Q$ m+ P9 X. k" Z0 {- g
var iedom=document.all||document.getElementById
3 \" }0 d+ J- u3 H/ K* g" o/ fif (iedom)
5 o8 x$ q8 D8 C" [, M* T) M" H7 `  d, ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 P' ]8 O% K$ P+ O" g
var actualwidth=''
' e6 \4 c! {  ^. a8 d. Evar cross_marquee, ns_marquee
5 k- Z& }7 U; g$ C; r5 J
$ K+ [( h( c$ _4 R. V* s) ]function populate(){
' F+ v8 L% b" N: E, U4 Zif (iedom){; @# b( b9 q% _2 `  n: I- m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 u9 {6 Q1 p" p7 N5 p+ I$ O
cross_marquee.style.left=marqueewidth+8
3 B  T* f' J8 ]+ `: \6 |5 Rcross_marquee.innerHTML=marqueecontent
! Y; M: |. \7 U" Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  O9 a2 d# I+ f8 \1 F0 a
}
0 ]1 c$ q7 I. }  F' B4 C1 Selse if (document.layers){
! R8 \4 C0 M2 R3 J$ Ins_marquee=document.ns_marquee.document.ns_marquee2/ i3 `- u7 g( ]' ]7 U
ns_marquee.left=marqueewidth+8+ ]* q* m6 A. x& W' v
ns_marquee.document.write(marqueecontent)( M+ Q3 a8 ~; N' [) S, d: w
ns_marquee.document.close()
6 n& W6 K8 k+ zactualwidth=ns_marquee.document.width/ `* I) ?7 e  C# g, }
}/ s6 U$ x- `; _3 v" o; M5 ?% \( O, T
lefttime=setInterval("scrollmarquee()",20)
) Z* q2 C0 p9 S7 u# d% w' r}
( ^. {8 ]3 C1 V, F$ y$ V# dwindow.onload=populate
: P% O- w! B( h& M$ j$ _& {$ u( T' H3 N( r# I6 J4 r/ K& k: Z- _
function scrollmarquee(){
3 c5 U! A: p/ o, ^+ Cif (iedom){
7 X( {4 s# g) E' g+ t4 eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! y! v4 c- [  f9 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 p2 N" c9 k" w" H( v" Y6 Telse
2 @  _8 B# i$ }: c) Bcross_marquee.style.left=marqueewidth+8. l/ D2 w5 }7 {+ g  R
$ X/ e) u% \( s& r0 h& }
}$ O; T, r# e. f, v( t
else if (document.layers){
& t! U: y$ x( e3 p7 O9 Eif (ns_marquee.left>(actualwidth*(-1)+8))1 S9 m- r; G- z; X2 q% L% b/ d
ns_marquee.left-=copyspeed
) z. V; U" P6 F$ z* N4 d$ ~else
) d4 a1 a4 v0 j) sns_marquee.left=marqueewidth+80 L5 |" l1 _! {" [7 X$ @
}4 \, O9 c6 c: r  Z( Q6 L& u" W
}6 f+ l) S: z7 P$ w. x4 ~% D

0 H3 g2 l/ k' mif (iedom||document.layers){. v1 G9 J! q5 F
with (document){
8 Q9 `7 a  }5 c& U# ^1 Q0 R2 [5 Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 E; [" W4 F$ D( N5 O2 O
if (iedom){
3 l9 r  c+ m/ Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 r3 O1 d) G  h( \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: z4 w% e- N7 e6 F) b4 o& V9 awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ m5 E# Z- c, l
write('</div>')& i1 y. L' b- W
}4 @. v3 V' P2 r- V5 o
else if (document.layers){
' ?7 g" i; V& Q9 b+ ~. U5 Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ U3 l: z+ h% n( r; r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& z) h3 T' |2 n: p- e1 n3 Kwrite('</ilayer>')5 {) J% W! S3 E' F1 g. s7 F2 J
}
6 ~3 z- j& E2 U5 P& [9 Ldocument.write('</td></table>')
, }* ?! _7 l2 h) ?6 O' e/ @}
, W& g8 ]0 R2 s$ i: I: _; F}
1 W- |+ _* j& E1 r</script>




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