Board logo

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

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

//修改宽度) q0 Y& ?# `5 j% L' s7 Y1 ]
var marqueewidth=300
* G. N% g- D: M3 _! d: x% G/ I/ U, h//高度
( |( B4 X3 m" o  Fvar marqueeheight=25
! _' u: f! g! a5 j/ @- E! j; s+ @//速度(1-10)2 N- r6 X, T4 m1 O: M' T, U
var marqueespeed=3
  C1 [0 U# n9 Q4 A* j//背景颜色# Y4 R' F5 a* D4 o
var marqueebgcolor="#FFFFFF"
) w2 J/ T6 D6 ]  ^9 Y. |//是否能暂停 (0=no. 1=yes)?
9 Q$ e  O* }+ S! L1 b. Y* i+ {( |" ^var pauseit=1: z" f  ~. E2 g

$ ?: H/ G8 u% _, y- t: h  R% b: P//修改显示内容
% f3 ~4 a4 n0 g( p: k2 C' m: h' gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 E. n4 p- Z" O' q# n
* ~1 m. `, x# a* V& g8 _0 Y' y- a  _1 Z8 c
////下面不需改变////////////* y1 ?) s/ G; W( k

3 B6 l3 N: ~4 W6 _. hvar copyspeed=marqueespeed5 d* J( J: v( m3 I
var pausespeed=(pauseit==0)? copyspeed: 0  g( J, E$ T& w9 m7 A
var iedom=document.all||document.getElementById
7 n; n0 q. S0 o( P* Mif (iedom)+ v- B. d* |1 R' g  V) Z' R6 |" c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: G, C" K& i; O* n- T; S) w' Dvar actualwidth=''
2 e4 H7 n' V+ y3 n6 [var cross_marquee, ns_marquee
9 D% Q4 }* k7 _" S, o# T6 B! S
5 O" ?8 t" |, i" T; E9 ^function populate(){
% H' }/ q. J9 i# `! o" kif (iedom){
4 d3 ~% p5 `7 ]) ?. Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ e+ P# w# t5 A; u9 Across_marquee.style.left=marqueewidth+8( }& c: _9 Y: d* D, ^* v0 j
cross_marquee.innerHTML=marqueecontent7 M* L/ V5 j/ O* w: e8 y4 p/ n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( n  P( r" r: f0 [& ]9 |}! g7 c0 }+ `& z! I
else if (document.layers){; R* d& @0 Y: X2 {
ns_marquee=document.ns_marquee.document.ns_marquee2" B* y6 m  @2 \( S6 V. x
ns_marquee.left=marqueewidth+8
5 f- y: Y; f; v& n6 p8 Y* nns_marquee.document.write(marqueecontent)) q' ^4 u# v4 `3 Q* P: E
ns_marquee.document.close()5 P) J) X5 U8 e& B
actualwidth=ns_marquee.document.width
4 D' r$ ]% h* G9 S$ P5 d  p}4 T5 n& c( ?4 Y; b: z9 j( y
lefttime=setInterval("scrollmarquee()",20)
, H& ^1 D9 v; @}
+ X: X/ W' I' V+ `: ywindow.onload=populate
- d2 D. B! c* Z' n: {; ]5 m5 F8 [+ k1 u5 C
function scrollmarquee(){; z' h! _' |; F" }) O
if (iedom){
. `) U- _( ]( c, nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# l+ n/ k* G& Q. E. n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 k& F1 Q* b) m2 j3 p# {
else
+ o+ }3 U0 N' lcross_marquee.style.left=marqueewidth+80 b- ^% {5 f$ Y
! b7 Z. Y( m! E
}5 M$ O7 R! g" _3 g7 a, g
else if (document.layers){$ B6 t7 V; I0 |3 r. u
if (ns_marquee.left>(actualwidth*(-1)+8))5 _+ p& L6 I" H% x
ns_marquee.left-=copyspeed- x( @1 o3 C, U' `6 ~
else; L& y6 k4 ~/ r+ w* E, N" P- E% ~" a
ns_marquee.left=marqueewidth+8; b4 A5 P% p8 q* c
}
$ b% b& q: ^& P- h( f/ C}! B  f9 U7 v) F4 q5 r# y

. H4 A! o) R8 g( ^( ~. `if (iedom||document.layers){
; s8 Y9 ?: w" y  e# N& ^with (document){9 d: G6 y0 z7 d( @- M6 ?! Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 [/ S4 {4 q/ q2 k: `! V3 x$ h- C
if (iedom){6 Z1 M0 I% n- g! t0 S! }( |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" n# n. }4 p0 [7 m4 E0 `* K/ Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 k% x) [) l1 p3 b( L; ?( k% T- v9 k; Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); \* m( B8 O( X* `4 p
write('</div>')/ |  `3 \" [3 I! ~' S% `2 Q$ w- J# L
}& s- ]9 H( J7 D% T, U3 C1 w1 S) m9 z. M4 Y
else if (document.layers){3 j4 O6 P# f5 R& L  M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 `1 t. h5 m8 [" fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 \6 p" V4 J' I
write('</ilayer>')
$ m5 E0 Y0 O$ h4 {& M: [6 A}- X, G& @( I% o; F
document.write('</td></table>')
. R* \& g( `1 C( O4 B' z0 {}
5 c2 w9 k- F4 \5 q- r  K}
( r2 ]  J) b5 \% s/ B4 B</script>




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