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

|
网页之跑马灯文字特效
//修改宽度1 N4 P5 K4 s: s, Z4 K) W
var marqueewidth=300/ Q& `7 m1 @: A7 ^
//高度
* \+ c; H6 f, V; h Z: }3 X* y |var marqueeheight=25( c: a8 J: D- f8 `- {6 m4 T
//速度(1-10)
- `# Q# j$ N/ C/ d/ j8 ~5 ivar marqueespeed=3
0 s7 C1 G) W$ } f& x1 J. b//背景颜色2 b7 T3 S4 _, U% ^1 h' K. W
var marqueebgcolor="#FFFFFF"
. Z/ [. P' O, z0 [% v$ S//是否能暂停 (0=no. 1=yes)?
Y% @) N4 `+ l+ ^) A- R$ Tvar pauseit=1& C" t% R% c2 G4 }3 h& F
2 n) M3 ~1 k' O) g4 Q5 t
//修改显示内容
6 L3 _7 ]4 A6 y4 x4 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ ^' o: @; `8 h9 T w
$ V- P5 u' A( N" `8 x7 `& K1 x( d
% i$ C/ [9 p3 ~ A////下面不需改变////////////
; c! \. k8 K5 X8 J4 a+ }1 o" ] `4 v: W. _$ ^
var copyspeed=marqueespeed1 B6 Q f8 a% u0 x6 Y
var pausespeed=(pauseit==0)? copyspeed: 01 G* S1 X# R/ [( K1 [" k; e8 ]
var iedom=document.all||document.getElementById
* Y6 [0 i# Z; ]: l9 _9 k3 c: z" M, Hif (iedom)! X# O4 ^# L3 q" y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 [0 ^! h7 u- e# K, W5 E
var actualwidth='', l) n8 k/ I3 y1 _) w: l
var cross_marquee, ns_marquee
; `+ O) l* @& A* ^. H* c
3 U/ b( Q3 l. l- F: N! @function populate(){
6 G/ \; x* b" \! J+ Fif (iedom){0 C6 O6 l4 j: V. d2 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 W S3 ]$ r9 U* h9 c4 F
cross_marquee.style.left=marqueewidth+8, G, [: U' G6 f' b
cross_marquee.innerHTML=marqueecontent# ^1 d, l7 W" H9 |, D2 D; C8 _% f {
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 u/ X- `" y& N7 \2 ^}& t E3 \) \, x' Z8 v: W
else if (document.layers){
, P4 W# l( q5 Z* y+ E% E0 Bns_marquee=document.ns_marquee.document.ns_marquee2+ S- F2 s7 X" B; k1 Q
ns_marquee.left=marqueewidth+87 J9 _4 a6 E0 ?0 U' e& j. H6 o) S8 H: H
ns_marquee.document.write(marqueecontent)
+ A; X# S: U5 @' g% Z* e4 R3 g. Zns_marquee.document.close()
8 `/ R: H1 F S# m; F! H A, Wactualwidth=ns_marquee.document.width
7 U* G, Q9 F4 n2 V}% w& i! S# _1 J& m# A
lefttime=setInterval("scrollmarquee()",20)$ e y4 ~ t2 w( L, D4 f
}
& o) x4 [! M9 [& s: R# B- I& awindow.onload=populate2 U3 K" f& Y) A# r* h3 ?7 T
8 r1 Q O" r: P1 S( I
function scrollmarquee(){' C) Y& z2 e `- q& g9 {5 N. d
if (iedom){
" e$ y0 f) Q+ z' Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ h$ V; u [4 l0 q8 h* Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ w$ m7 J! b# b5 Xelse, [/ \6 }+ C$ W: Y, L/ p# v. Y
cross_marquee.style.left=marqueewidth+8% `) t2 @4 _5 E# n
8 @7 X; m8 P$ d# B}
4 u9 b+ H8 Z7 h" T7 r& o9 Felse if (document.layers){" K! \2 a2 X! g4 L. w
if (ns_marquee.left>(actualwidth*(-1)+8))
- g/ U4 A# z8 `2 {ns_marquee.left-=copyspeed
2 C; E9 S" s% helse+ l; O) a5 ?) b- C }" B
ns_marquee.left=marqueewidth+8 s+ K; Y( _9 {; U1 q' g
}
) N# g4 K; e4 A% g}4 O: G4 g; M$ D: E* B% y- j
- n" f/ m' {3 k. sif (iedom||document.layers){
" b- [6 k! L" w! g0 G. ~with (document){
0 x+ |1 g) e/ ~. M" A1 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" g+ E7 l4 L9 |# S/ c
if (iedom){
) A- z+ P3 N, i* u& y7 O' swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) Z5 C* m8 k; z3 Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 t- j" v" C) w% d+ i7 Y+ ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. E" g0 [( A) L( F, ^write('</div>')- M) j( A, u* @) Y
}( K3 C# k+ q( _7 w p7 `) I$ h
else if (document.layers){. [, U$ {3 j: f' I" A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 z% _5 y9 k, I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% T+ X* b& s/ G% ]7 dwrite('</ilayer>')3 t% H, S: D6 n- x
}
* G+ V3 V6 l' _ @, A+ N8 o7 `document.write('</td></table>')1 t! M7 X" E" p. H: n/ ~: Q
}
4 i& w" k4 p- F}
$ a( r. p: u& r, D/ Z* Q# K</script> |
|