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

|
网页之跑马灯文字特效
//修改宽度
6 e3 k- e) H0 x: _* ~0 F; Q* fvar marqueewidth=300% w- I6 e, b( x
//高度! n2 P% o; j b. P. I
var marqueeheight=25/ [8 H2 o& E' U
//速度(1-10)2 N: q! r( E$ Z6 [0 h4 y9 Q1 F# h! _
var marqueespeed=3" K" g. C& M1 d5 d
//背景颜色
3 z+ ~# s/ }) L: o5 Ovar marqueebgcolor="#FFFFFF"- K/ k2 n; Z+ \1 a) c' e/ a
//是否能暂停 (0=no. 1=yes)?6 N0 y ]! g7 y0 b* {
var pauseit=14 |( D0 M% A3 ~( @: R
$ [# ^6 ~* q5 y. v( ^//修改显示内容3 G; }2 a0 |, T3 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; Y/ ^; B5 e& q
% [8 q+ [ p8 g& e' g4 P# t- _
: R4 ~* f+ [: H4 n: e- k# z( }# o$ Q
////下面不需改变////////////
9 M" R# w% u! V. d/ T. m6 P
: D5 k v% g+ X e' f$ X7 s+ lvar copyspeed=marqueespeed
. N; f8 v3 w% p1 N z- n- jvar pausespeed=(pauseit==0)? copyspeed: 0, \& [: p" ]5 }7 L. ?$ ~7 I
var iedom=document.all||document.getElementById4 r4 V$ M2 ^( E: I9 b' J: d
if (iedom)* ~6 @/ }0 j$ u4 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 p; d* p0 ^ w7 {; g. f5 \( K4 S: Avar actualwidth=''0 h8 V7 j! Z& C$ F) C9 n# |
var cross_marquee, ns_marquee( _3 f+ z$ y1 Y% g# x2 P
% w; b' n, {$ _1 K- `function populate(){4 s0 x# @' f. R% {
if (iedom){
. z# p0 z1 P* p5 a8 N7 @+ pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 J* y" a9 l; Q2 U% T) @
cross_marquee.style.left=marqueewidth+8
, E( J& S, H' Q @9 c, e# e& _cross_marquee.innerHTML=marqueecontent1 s. ]- t; T- J! _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- ?$ b I/ e. w3 Z* B9 E
}
9 x& J8 ]2 U, q, Jelse if (document.layers){
- V8 f7 K% X N! K7 {, Dns_marquee=document.ns_marquee.document.ns_marquee2
* Q3 c! U4 w/ h2 Dns_marquee.left=marqueewidth+88 B9 G& f! K- T
ns_marquee.document.write(marqueecontent)
6 Y9 J# Y1 z: f% J7 Fns_marquee.document.close()
; d) Q |# @3 D8 yactualwidth=ns_marquee.document.width
" N8 P; {' _# X5 o}. n& J5 @5 |* [, o, r9 q0 f
lefttime=setInterval("scrollmarquee()",20)
4 T8 h( F! U( ^9 j) _}
- U( k) J; \7 v# g6 ~) N lwindow.onload=populate% ^0 n7 i8 `% @
; d# B2 N g! ` F+ T
function scrollmarquee(){
C6 D* ]- t9 @, o& w2 ^* @3 r& @1 pif (iedom){
3 m3 D- o# Q* ?( S" E* Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; M U. w& ?5 F) Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; J& [& }+ V$ B: l
else8 d" {- p! W/ |# Q
cross_marquee.style.left=marqueewidth+8( t% ?. V, h& d" {
) V6 H( K- X3 \8 o n; g% I}7 q6 n4 T; n+ _* l$ c: T
else if (document.layers){' W. c4 Y, s; O$ H) {
if (ns_marquee.left>(actualwidth*(-1)+8))
: q: n3 S7 T; p1 D" [+ Yns_marquee.left-=copyspeed+ F& G2 C# Y9 u
else
$ h, u- k# t5 V5 O! Sns_marquee.left=marqueewidth+86 R( J7 t' e6 m7 h0 ~! n7 w# w/ x. y
}
V) g0 R! C/ R- d* J}
1 }6 X1 S( ~1 W7 N' i# H1 Y! R9 ]' [- ~2 z: F7 C
if (iedom||document.layers){1 q- s5 V6 ]( v4 Q6 a2 p
with (document){
) Y$ ~6 b, h1 o3 Z* _& L# I, s xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 a% i$ i. k/ _ I1 M, B) Vif (iedom){$ f# G6 K' z# L% [) J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* [ j( E; ]% r6 A- \- l4 a/ }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 r+ e3 I( K0 ^: ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 a5 h# s1 \- T4 p" Y
write('</div>')
# [! g0 p2 `. L}' _8 K/ S- N/ h; Q2 }, O0 O8 a
else if (document.layers){
+ h( j/ d; v! G+ Z$ c" T6 A! L, zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') F$ o& i& Y5 L& Y# y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ ^/ d5 A( B, R T z% _$ m! [write('</ilayer>')
# [1 J8 { m' K: z3 @}
1 }, S5 r3 ~9 U6 V! |& d X& Idocument.write('</td></table>')
- m; A+ N [+ Y3 K4 |}0 }* B# |& h1 N) N b
}6 s$ ]9 l2 R2 i" s
</script> |
|