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

|
网页之跑马灯文字特效
//修改宽度& v& v# _5 n3 d
var marqueewidth=3009 N5 l: ]& f6 R6 p5 l m
//高度
3 Q0 D {3 `0 F( }var marqueeheight=25
, j5 t" |& K/ [1 |9 ~) u$ `//速度(1-10)7 Q: P4 `- y5 l% {5 m' C
var marqueespeed=34 x# @" V% H8 x5 t% @9 Z2 p
//背景颜色
( Y+ J4 q9 [& nvar marqueebgcolor="#FFFFFF"
0 C. L7 `: p* B//是否能暂停 (0=no. 1=yes)?
) I z0 @4 z4 p$ _, ~0 L8 Y" i! gvar pauseit=1, d P4 Z( t, e( O7 h' M# ? ?; I8 U
) N z I6 r$ \6 P5 A4 b7 Y
//修改显示内容7 X' U/ \$ g U. [7 I" G2 h( z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' G- k! q( O4 }
$ i- B* k0 {+ N6 J
' V7 R- [- V' z+ [( O////下面不需改变////////////
4 f0 N2 q* C7 K" |* C8 W7 B/ \0 U
& s$ }% `1 h/ u- Bvar copyspeed=marqueespeed
5 {# [ y0 Y; N! h0 D+ Hvar pausespeed=(pauseit==0)? copyspeed: 0; A0 c7 ]. g& R* ~: `1 z( B
var iedom=document.all||document.getElementById) l0 _0 r/ ?& [7 P: A. h
if (iedom)8 i8 `1 N- v7 Q( R- c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 _; \" L4 ]4 b2 Q" w2 {
var actualwidth=''
; n9 ]5 R2 ^- i3 z$ [var cross_marquee, ns_marquee
A% c, C: w- K3 ?+ \* V2 h6 e; Z4 s( w/ ?& f ^* S( h1 E
function populate(){) F$ T: h1 P- r1 Z1 h
if (iedom){1 c$ ?3 O: P( R/ A4 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* `$ Y( |: X" D* [0 x0 L
cross_marquee.style.left=marqueewidth+8
/ C# H+ j! E! X% ]7 S- ecross_marquee.innerHTML=marqueecontent
) x1 J+ Z2 `0 J; s. x( m& Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' W) T% M* J0 @}
3 B* I. A# S; R1 J8 Xelse if (document.layers){
) A! Y) j2 L( [5 v- H0 fns_marquee=document.ns_marquee.document.ns_marquee29 K% i* f( g6 c8 H
ns_marquee.left=marqueewidth+8
% y) F. ~' O; F @$ Tns_marquee.document.write(marqueecontent)
9 Z0 V8 z' }7 Yns_marquee.document.close()/ ~- Y7 P! O" B+ T
actualwidth=ns_marquee.document.width
- @/ I5 x, v, z4 h# C! ~4 m}2 a% G8 p# M0 L) B
lefttime=setInterval("scrollmarquee()",20)$ X# L- g; w, g. ?% g
}
+ [) F- P, @! z$ Q6 S7 G0 p+ [window.onload=populate) H6 N% }& ?5 g" r
6 L! ]1 B7 m4 d) I
function scrollmarquee(){0 { w5 i' a/ d. E
if (iedom){) _9 g e) Q: o4 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 q9 ?/ Y: t3 X- l6 hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 K4 V& k7 |7 k6 c' j) lelse
# Y4 U+ U8 {5 b7 t% G( m" jcross_marquee.style.left=marqueewidth+81 b+ w0 Z+ M0 V" h: C. r, T* F# C
, ~& M6 K$ }# B: o( _4 |* S+ C" j" m) m
}
- C" P; W* Y& A9 Telse if (document.layers){
, T* q; V/ S; w3 H+ Q& u, ?if (ns_marquee.left>(actualwidth*(-1)+8))5 q3 D) L$ X& P
ns_marquee.left-=copyspeed
/ g% H. Y Y5 lelse
, K/ ^% @2 V. ]' H4 b+ Ins_marquee.left=marqueewidth+8/ L$ E& T: X2 s. G* ?9 k+ v# k( ?
}
* }7 v) p8 l' K! ~+ P}
V3 l& V! K+ L# ?0 t: s7 `& S2 s7 ]- v3 T4 \. ^
if (iedom||document.layers){
( k2 U- d4 Y, x) v6 S) N& gwith (document){
% ?- z( m) S2 n; a& y, L& k pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! W c# C6 \% E/ f/ h1 `
if (iedom){
o S* |, | G2 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 @3 V1 ? Q. e5 ?' h. A- Z3 l3 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 E' F$ j7 q4 }3 Y5 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# e% M2 k3 I4 ?( Y. P# Bwrite('</div>')
) f8 S! b y7 b1 U9 c9 k}: F* ~- p% n* s2 V9 x3 F P
else if (document.layers){
. F2 R- [0 K! B9 @' mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 Z$ v3 E+ h" h0 a5 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ N0 ~) d0 {4 F6 hwrite('</ilayer>')) I% c# f1 U6 X& Y/ } A. e% U
}
! r2 X+ X+ N( I! bdocument.write('</td></table>')6 [$ H4 o) [3 r
}1 A7 c$ h3 m' }$ l
}& ^0 x; p; C/ n ]* K5 D
</script> |
|