Board logo

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

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

//修改宽度
8 w9 E  l: n9 |9 @) qvar marqueewidth=3005 e$ X5 Y( j! a& |! Y3 E
//高度* E: Z7 D4 u1 ]3 C. z6 O( ^' Q
var marqueeheight=25
: w8 B5 x: Z: }- w4 n; l. z/ w6 j8 s//速度(1-10)
' g- }3 m& y, q! r) {8 avar marqueespeed=3( }8 P3 m2 f$ X& j8 ]" X; z
//背景颜色: K4 O- L) N% k/ \* i, p3 `8 O) v
var marqueebgcolor="#FFFFFF"
. X* R' U% [! v, v# C7 T$ o, B//是否能暂停 (0=no. 1=yes)?
. J) C- }$ b) B. Gvar pauseit=1
5 W0 `$ H4 E) Y; C8 n1 x3 u0 p2 R2 [1 {! K2 q
//修改显示内容
/ d- g" }3 t: Z; w" f$ E' C. mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ s5 k; _1 z/ }/ z
4 ~" Q  |4 w# y. d' K
/ [4 V9 {+ r5 g1 `3 ^( y" ~5 E////下面不需改变////////////  b' q5 D. M5 I
$ V3 k0 Q' ?+ g; B" Q1 F  r
var copyspeed=marqueespeed
; b% Z" ~; \/ S7 k( {" ^var pausespeed=(pauseit==0)? copyspeed: 0; s3 W  v" S; J" f8 I$ z# c& w
var iedom=document.all||document.getElementById" y' \. S( {  |% n
if (iedom)
! ~& p+ g5 H  D& _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; Q( U1 d5 K6 {; Z3 v" D8 w( Dvar actualwidth=''" p  b/ w" x' n% M! E* I
var cross_marquee, ns_marquee0 ~5 v" E* Y- n( o
1 Z- C" j/ F0 n% @! m7 O
function populate(){
* @, }; }* X' z- y% r3 Z) H/ v6 H, ?: nif (iedom){
+ C3 m6 N5 x. A) d1 A9 L( J  Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 o8 j( t: P4 I% F3 k; t& m* O
cross_marquee.style.left=marqueewidth+8) K" x2 M1 Y( a6 o0 M
cross_marquee.innerHTML=marqueecontent
6 k1 Q" S; q( f3 @* Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ s6 y7 B9 e+ ?" i& _# I$ M" `6 P}* }/ p% f! C& f+ V
else if (document.layers){" h/ p9 q' x, m" v3 R$ F
ns_marquee=document.ns_marquee.document.ns_marquee2
: z2 Y3 a+ p1 B& H2 o' Fns_marquee.left=marqueewidth+8. Z/ |1 w; }& {5 F7 P3 B5 [. H
ns_marquee.document.write(marqueecontent)
) _4 N/ E% z7 a3 Q5 g3 Dns_marquee.document.close()
) x5 A3 d" Z9 C' c' h/ o; vactualwidth=ns_marquee.document.width  j6 V; E& w  A$ _0 S0 [1 I7 K
}
* d; g5 S: N  Q$ F' w+ Ulefttime=setInterval("scrollmarquee()",20)
3 m- t* m/ B. A& S# E3 B$ e}
. P5 o* C# g  P* F, f/ I+ m& Mwindow.onload=populate
# r$ p2 g+ B7 i4 d0 a; V0 R3 w( w
6 w! y9 H- |  c! Hfunction scrollmarquee(){
5 `- l8 h/ s/ L1 @4 Wif (iedom){& I( t  P* o% k( U4 h( v# x& k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( k6 ^1 Z2 s; ]2 Z: S2 e* fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: n) r3 j! m0 m6 h
else
7 ^/ y* J( w& x1 z' rcross_marquee.style.left=marqueewidth+8& Y- Q3 d' \$ i6 \6 B5 B) g& a

* c: i9 r  \7 ~. _- L* l1 }1 W}
  g$ _+ b# s5 V+ G7 o0 k- \else if (document.layers){
, r# N+ r* Y  kif (ns_marquee.left>(actualwidth*(-1)+8))
+ R+ Q) E4 R/ bns_marquee.left-=copyspeed
8 p2 C4 ^' `9 s% Uelse% E7 ^+ X3 a8 u: U( N! O& |
ns_marquee.left=marqueewidth+8
/ s7 m+ W' ~3 p* b7 |3 y% X& o3 h  V}2 J( ~3 K$ J* M9 o
}
- v; v4 [( Z3 N" Q) o
" U! j% B+ K/ w5 ^( Jif (iedom||document.layers){
5 V( d8 v/ N/ Uwith (document){2 M+ E& o/ a. o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& c: ?: c' s6 L6 G; ~if (iedom){0 |7 a; F+ H; f3 K5 W+ \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& h# z0 v' z' g; R7 k! G4 Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( u5 {+ [0 j$ g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* t% U( s: p  e+ e
write('</div>')
" \" }, |8 m0 a2 B' a) J}# B& s% ^' i- D9 B
else if (document.layers){4 o4 @0 K2 o0 f. y) l/ O# C7 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 w) b( S4 D( d  C2 d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& q, J, C" s, ^: M& `8 @+ ~5 B, G
write('</ilayer>')/ _) w! `% B$ |& T+ C+ a
}5 S4 R3 h. W6 h
document.write('</td></table>')
+ D% {( k: H; N- Y! ?7 m2 F}
& _1 ~3 r7 a$ E" r0 k5 |/ P0 t1 M}" a  V7 w: \1 c* ^5 Y; @) N7 d
</script>




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