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

|
网页之跑马灯文字特效
//修改宽度% q* w5 l: i% t$ W
var marqueewidth=300( r m% P* v! w) J
//高度) p3 _; [2 {9 s3 F$ l
var marqueeheight=25/ U3 U$ y- R7 Q
//速度(1-10)6 c! R" c& J4 n+ s
var marqueespeed=3" e) Z. [' _& B! x: k# S! g
//背景颜色
' F L( T" w' `0 r% W9 Tvar marqueebgcolor="#FFFFFF"
4 g0 v9 s! n) K2 a! M# ] j//是否能暂停 (0=no. 1=yes)?
# s Q8 X2 x6 J7 _var pauseit=1
1 L0 \+ `/ i) V# ^- }7 l4 r+ }* K6 j$ a' _' Y( P
//修改显示内容/ m. T6 Y3 R9 o6 x2 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. K. u* _9 ] g, h3 T6 n5 v
( E I( \) S7 x4 h
7 y Z: t: @+ q% {////下面不需改变////////////
% x5 ]* H* @* h1 c1 X7 v7 o
* { G5 I, D* zvar copyspeed=marqueespeed
3 L7 v' Q- F9 w- xvar pausespeed=(pauseit==0)? copyspeed: 0# g$ t1 ?- E9 k. T+ w( v# I* ^& I
var iedom=document.all||document.getElementById9 Y1 ^$ @3 K3 T+ A; _- s
if (iedom)' l7 B' K$ Q E2 Q% e1 m1 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 Z4 B9 j1 b% b- Z( d& h
var actualwidth=''
8 L; o9 s; f6 |! x! n1 cvar cross_marquee, ns_marquee
- _6 A0 @$ F L! I1 @7 h; ]/ E& U" Z/ X; i2 ~* K' w( ~- B0 [
function populate(){
: e+ D3 [ e5 u! Jif (iedom){$ D8 f1 K: S8 W1 B4 D# V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( q$ }: A2 ~+ _cross_marquee.style.left=marqueewidth+8
1 K( M; }* k+ B) T9 ]cross_marquee.innerHTML=marqueecontent
5 d( C9 W/ Z0 L; X" l; F. \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. O `4 _# S8 D1 N- F, Z; b! u% c}/ `5 a g( Z! J: j6 ^0 a0 a
else if (document.layers){
4 @: E: I) }. @ns_marquee=document.ns_marquee.document.ns_marquee22 Z: [# X3 S! t0 Q8 A- ~
ns_marquee.left=marqueewidth+8
2 g* o$ C( `* d$ K% s2 ens_marquee.document.write(marqueecontent)
- K7 O9 Y" @3 N, i* R( n+ q1 G6 a% uns_marquee.document.close()
. Z, y# a# B" Uactualwidth=ns_marquee.document.width9 V# j) U [( V; W
}
; p6 a9 s5 B6 g% V% C% x( elefttime=setInterval("scrollmarquee()",20)1 [9 W; f8 i3 ]; H# A( }# _
} F9 ]$ O4 V3 N) n
window.onload=populate
$ ^$ f0 l$ d5 p& j7 }4 y5 Y
3 F) @$ a: k3 Q+ ffunction scrollmarquee(){
# {& C2 t3 m- Aif (iedom){; d! q" \( x- L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); L" c& K7 o1 F; B/ [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 Y, g6 O- x. ^
else
+ N0 W) y* f; z$ ]9 Ocross_marquee.style.left=marqueewidth+8: h: c' ^. n! d5 L% \% d
, y" R. v& @9 T+ h2 T1 ^
}4 e1 A; _# i3 O8 v8 q8 Q
else if (document.layers){
8 P6 Q V) U6 ~: E; K2 ^! z* {if (ns_marquee.left>(actualwidth*(-1)+8))( F' |: U8 K! i; Y# V0 |+ [
ns_marquee.left-=copyspeed
& p6 X* L" _# p! a* X4 ~else' N' r1 d- ]3 ^3 X; `/ ?
ns_marquee.left=marqueewidth+8
+ x% D& ?5 w/ Z- F. I, S. t}
; d2 b3 ] x7 O1 ]/ R. N) o2 {3 |}
& l# E6 @( v7 |# \/ V) f; |. i0 M* t J7 P
if (iedom||document.layers){
\. u9 ~; \9 i$ Rwith (document){% B) t) @2 U, F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 c4 y, x. e' z) q% }- X
if (iedom){
& x+ h1 s) T- R; u) S9 i6 F) V" l$ Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), m% m8 g8 P$ I! j/ }8 y. A9 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 l5 ?# v. L; H* Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') b7 E" k7 b1 D( ]0 p
write('</div>')7 M: }5 U1 K# d4 y6 ?
}$ K9 U7 ~# W6 G/ B" d
else if (document.layers){: C. Q* V% w1 Z. X9 a3 a3 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ r% @) O. g; x* }# m) E& s2 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 m! C5 t% Z y4 n, p; g6 M# g4 J
write('</ilayer>')* h# x: \4 j8 m1 m+ q
}. f7 X; X& f- \# w
document.write('</td></table>')6 n! d( [# M/ a7 q$ }7 [/ @8 x
}) n% ?- a4 s1 w7 }8 B! v6 S p
}: y, j ^8 m( V2 a
</script> |
|