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

|
网页之跑马灯文字特效
//修改宽度
2 T6 A) C w) a) G+ H4 lvar marqueewidth=300
1 ]- ?" j: p, G( z6 l4 b4 L6 x//高度! h: @ }! H1 N9 v) O* l: w; V8 \
var marqueeheight=25 c9 O7 S2 |2 ?8 L; v+ \% Y
//速度(1-10)0 d3 P, b" P2 H- T K! ?8 ~
var marqueespeed=3
- G% h4 N2 I0 o. }: o6 I# W) [//背景颜色
' K) L* v# e! U- ~: @% I# Y$ b+ L( _var marqueebgcolor="#FFFFFF"
( B5 Q) D3 g& u: @* S//是否能暂停 (0=no. 1=yes)?
5 M9 h, L& ?+ C q; Tvar pauseit=1
% N- F; Z0 C7 \$ V& u1 q5 g8 h4 n2 _6 I. X8 J* m' a* ^7 l! c
//修改显示内容
1 Y& D7 @; j# avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) h3 o6 C$ d% q% O- r9 e* s p, p) [4 m4 V' x4 O( ^+ n
/ B! j: X' m+ u( m ?: q [0 n6 a////下面不需改变////////////
. B0 M8 b X# c T8 k# O4 q) C1 D# I$ z" l& f0 O; Y
var copyspeed=marqueespeed o3 ]$ g+ ~ H/ G! q
var pausespeed=(pauseit==0)? copyspeed: 0" L b- x6 z: w8 o
var iedom=document.all||document.getElementById
) W& e5 e4 j( H T2 I8 q5 q% c0 J6 ?if (iedom)
+ V' P0 Z2 N/ H! q( n. ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). g! e0 e) ^) h
var actualwidth=''$ G0 c" O) S, ~/ T8 L7 J) T
var cross_marquee, ns_marquee
; w! i2 q' F% s# L9 k- [5 B/ W: y$ p: V0 {% U3 ?
function populate(){
, c1 V7 [* j9 L8 Q h: mif (iedom){
- p6 q, c5 ?% ]- ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- ?0 w9 A; o: o/ C% l
cross_marquee.style.left=marqueewidth+8
% _6 s+ V7 l3 G* q) j8 _4 \cross_marquee.innerHTML=marqueecontent
8 T$ Y1 @2 C# X, l& y) t- X- a. Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 P. v0 I3 B' J( i: o
}$ m% e5 H4 a9 i1 l" y: C2 u
else if (document.layers){7 ^6 r# N6 t+ [( g1 H4 h) k
ns_marquee=document.ns_marquee.document.ns_marquee21 L8 J2 X. }; M4 e( |9 i
ns_marquee.left=marqueewidth+8
$ M: i* z3 a1 [* j2 Ons_marquee.document.write(marqueecontent)9 c& S4 _0 {: P0 U& v1 r
ns_marquee.document.close()
# `4 E3 b# [! u- [+ c+ G/ mactualwidth=ns_marquee.document.width
( X f4 t J0 D7 ?) z7 L}
9 W+ ]+ {% C( N% F9 g4 P6 v' S+ ?3 Glefttime=setInterval("scrollmarquee()",20)
9 x, V$ F6 m5 ^ m: q}! Q" q9 T6 t% j2 k( ]$ M
window.onload=populate
3 _, } }) d: R; q2 z: W& o# y* d* H2 d3 O
function scrollmarquee(){
, D" A3 ^7 @2 l4 zif (iedom){& e( i5 n, H6 P$ L: Z; W* @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ x" x) a( K3 u& g0 e- p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( p% l& y5 i. i8 C9 b
else3 d9 g! S( a9 C( @, o. ~! W+ x( o" \
cross_marquee.style.left=marqueewidth+8' [( ?6 `& y" |& ^9 `8 z0 k7 m
; R6 c7 V3 y. N5 b
}
! O$ S* B* D; G* d; d* P! Nelse if (document.layers){1 O: w& ^0 N) S6 i! w
if (ns_marquee.left>(actualwidth*(-1)+8))% ?8 c8 f# P# n: e9 B$ n' Y& t
ns_marquee.left-=copyspeed
{2 y. P3 H( I3 ]$ |4 s$ Helse
3 Q8 `! p6 R' i s# Qns_marquee.left=marqueewidth+8
. f- d7 D* X/ e7 c; J}
- Y3 v: H( [1 R# B} {* z+ S6 K1 D5 [" `) M
; T ?: G- M! \! c
if (iedom||document.layers){
8 B8 B3 c$ D3 G& j7 W& f, Qwith (document){8 Z! O' O% K; a8 U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') u; c. a) R$ k" {
if (iedom){
, w# c M6 S; Q: ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% H3 G8 c& R; q7 Q/ b& Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. D* r% E( h; Y" u& g6 K3 C2 cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ ~3 e& }7 c v7 T, y J ~+ m
write('</div>')
6 T2 k5 _6 s4 w9 E0 i}8 z9 L" O! o! z- k, v+ E
else if (document.layers){7 c& q* ]2 G9 e- W2 m n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* c: ~4 ~ [6 kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ _9 t8 |* Z- X" }write('</ilayer>'), p& ]* e: T- q( L0 w& W7 u' B
}: l& m4 L2 m8 i4 S. `$ a% _5 K3 l" u
document.write('</td></table>')7 v" W$ @. T4 n+ h; A! h
}3 I8 h6 |+ P. ^$ }
}
H1 f4 r% q% i5 S4 L</script> |
|