|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
4 {! d2 P0 w6 j! V7 X; H7 a& Uvar marqueewidth=300
; u+ i w) i3 B5 B# g9 i. ]//高度% }* l# u3 E" n# j4 M
var marqueeheight=25. J, l3 _% h/ C% Y# c6 u
//速度(1-10)( f* W+ y) f4 G
var marqueespeed=3
" i2 v# s4 }2 l. _1 w. C//背景颜色
$ J! E1 c9 s* Vvar marqueebgcolor="#FFFFFF"' q( V5 Q, V+ T, m" z( o; c$ G% v
//是否能暂停 (0=no. 1=yes)?* x. r; z9 d) a
var pauseit=1
: z5 F3 _3 ~6 g: {6 R. v3 {8 G0 W( Q4 [
//修改显示内容: C$ H+ i5 D7 S3 h6 G/ M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ u; O/ M$ R* P* R1 d8 @- Z3 N+ R; E3 v( ]
- _% w! X% V! `- E+ Y////下面不需改变////////////
0 D2 ` ?& q1 M2 ^) y/ d% n6 p; ~" a3 }" c3 z1 k+ [. h
var copyspeed=marqueespeed
o0 A+ H- P# u' K# yvar pausespeed=(pauseit==0)? copyspeed: 0
$ v9 g( A4 q8 H; u5 H5 qvar iedom=document.all||document.getElementById
* t5 U$ @* ?6 U6 w8 r V& q3 Qif (iedom)% |: V8 p& W1 y# [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 \6 Y6 N. B% x$ t Vvar actualwidth=''" g3 r" @8 I7 E$ M' o# ~. ]$ l2 W
var cross_marquee, ns_marquee. I5 E3 q* |7 g! g F& X+ `
. \) @; _4 _) _0 lfunction populate(){
: m/ @1 \* X5 Uif (iedom){: K+ T' n% }' W7 _( J6 N- P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) @( H) o* H) T. @3 Fcross_marquee.style.left=marqueewidth+8
: [0 Q0 I% M. f5 M" Ocross_marquee.innerHTML=marqueecontent
3 d$ T, ^; v) _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" v$ F9 J! t; R j
}2 v: G* @0 c: d
else if (document.layers){
/ I% ^6 l+ ~" p: X$ kns_marquee=document.ns_marquee.document.ns_marquee2
) j! p) _, ]1 X8 c9 ]3 B: p9 |3 ins_marquee.left=marqueewidth+8
) b* W. [( X6 Nns_marquee.document.write(marqueecontent)
" P, X5 L; y- w8 jns_marquee.document.close()
x5 o* J$ q9 C* b. e% @) hactualwidth=ns_marquee.document.width
" ?5 U# l" w% Z. Y a. l}) e0 Y$ ~8 Z, d- g1 N
lefttime=setInterval("scrollmarquee()",20)
- ~# f& W9 W$ z# v# j7 [5 ~}0 z# o2 a3 V! T7 y, h( l1 h
window.onload=populate
! L B8 i/ k. @; H/ U/ b4 n
`( K3 f% L# P/ _$ |6 ifunction scrollmarquee(){* K3 [" N( K$ | j8 n, a
if (iedom){
' ?; e0 q# N7 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ B) c# f; @ C6 W' G( ?+ P; v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' e2 y& ^* l3 r
else
/ }$ h) i( z' X) h; H9 Zcross_marquee.style.left=marqueewidth+8
1 N q0 V8 `1 l
( C1 W3 l+ q+ I2 x/ z- k}
' e5 I% h- s* C9 U3 M# O0 \. Eelse if (document.layers){. Y2 p( A! e7 A8 S# x4 y6 Q
if (ns_marquee.left>(actualwidth*(-1)+8)): e% W) Z% R7 J ?$ }* O
ns_marquee.left-=copyspeed6 C# @+ ]; S2 m3 j* }8 z' @
else
: }3 ^+ E2 C L2 T6 A4 U9 `' ]3 gns_marquee.left=marqueewidth+8
$ H: Q( p2 P* c% v/ {5 o, Q V. H" G}
' e' @2 U0 y, |+ P( `}0 {3 [0 u8 U; b7 |6 h: [
9 K, f# I2 h u% T& fif (iedom||document.layers){
3 Q( s6 Q! W% {7 vwith (document){
- s |" t3 `2 p+ I6 ~& r. Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ g J+ H# M; ^) L
if (iedom){% A- v. G& ^; Z7 q, r7 P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 U4 {7 c# W3 H0 q5 |9 n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# D/ v! d$ S3 U4 F) ]. p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* L. k2 F; c# j" R! Wwrite('</div>')
% x- W% c) D/ J1 z- g3 k}2 G2 ]& r* ~2 i& Q5 P
else if (document.layers){/ E- a0 D* D/ I. [% I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). {* I# |. D. L& H$ S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 L6 u% Q* t5 Q* A. f( Z
write('</ilayer>')7 s! M4 g- o, n E" o- ^" m7 ^
}
; I: T7 K+ c+ _% L- kdocument.write('</td></table>')
|9 t/ {2 V" I) O# F3 y, b}
* }0 }7 B) W. v! ?}
% k* Z: y3 K) T0 v# t! L0 o, t</script> |
|