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

|
网页之跑马灯文字特效
//修改宽度
6 r6 x1 [9 |9 S1 a" Y9 bvar marqueewidth=300 ?- H) I' V1 C" Z2 c) Z* ~4 ]) g5 ~
//高度5 \! d }7 E! y- i
var marqueeheight=25
0 k" I! z/ Q& `1 y//速度(1-10)/ J9 F) y) F9 V$ q
var marqueespeed=39 s6 D7 A$ X) L _ Y% ~
//背景颜色
# w; |7 A0 \- w- \var marqueebgcolor="#FFFFFF"
( f X H5 l0 z) b9 J//是否能暂停 (0=no. 1=yes)?5 e7 f" @# z' F% X+ r
var pauseit=1
4 R# f9 x2 [' |- x5 N
! m; ?7 f: Y! d; R//修改显示内容/ E8 J! I9 s" ]4 b B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! W2 }& m( m: @( M' p3 z
8 c! n; Z- C+ j6 Q1 Z2 x Q# I: [+ [* Z
////下面不需改变////////////
: i- b3 C% }; M* x- e: m! m) L2 i S' z- k
var copyspeed=marqueespeed
8 `- F5 b: [/ H) m7 Kvar pausespeed=(pauseit==0)? copyspeed: 0
$ h% d N# D4 y# N4 Nvar iedom=document.all||document.getElementById" D( N b6 Z- r1 n/ o1 w
if (iedom)
" {. Z5 L) p% [% L* {( ~, l: Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" b) o: F3 \8 `% s5 D2 `
var actualwidth=''' @9 I9 v% H. V/ `) S$ l
var cross_marquee, ns_marquee- b5 U. ~ {7 d
) Y' G6 n- |8 t- g/ _6 w! l: ?
function populate(){
9 j. q* l# [$ C$ P- f( B$ Fif (iedom){
2 @: H1 F" _3 B# `2 p: ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! j( [/ }$ t$ p2 {) b
cross_marquee.style.left=marqueewidth+8
) X3 s* \' ?7 |/ u* scross_marquee.innerHTML=marqueecontent
( S, J! Z$ ? F& ~* i5 ^" eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ g3 E5 h, }" o9 I: n. t}
7 b+ C3 y& k! velse if (document.layers){' c/ T- A2 \9 G* {4 m
ns_marquee=document.ns_marquee.document.ns_marquee2/ H2 Q- n% @) ~& R7 \8 d
ns_marquee.left=marqueewidth+8. q, g% a/ B. e- t2 J; y8 P9 V
ns_marquee.document.write(marqueecontent)9 N5 |7 O1 o* d% Q3 x
ns_marquee.document.close()
# ~' p) Q1 F$ e% W3 Q3 pactualwidth=ns_marquee.document.width
3 p3 o) |3 i8 ^2 ]" F}
7 g8 e" z8 _9 z; h. {* zlefttime=setInterval("scrollmarquee()",20)
# ^0 v1 c' P. O. h7 _7 F; W, n" w/ @}
" H& J* {2 V+ p5 A" w W6 U6 owindow.onload=populate# g2 z' t0 K8 q: x1 G
" m9 a" l! h2 z. z' y Q9 sfunction scrollmarquee(){
! K, P9 X4 q" H6 C) L( eif (iedom){
$ U) [- M9 T: y& gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 i; {& H+ | A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% q4 W D8 S' i! d0 D" d$ Y, v/ Telse/ Q+ h) c* G& P4 a( \
cross_marquee.style.left=marqueewidth+8
( n5 @, A* |2 C: O5 H; `$ w9 I2 |: R6 K2 v$ `1 {/ S1 G
}& e2 j! g) o& ]0 x3 I) T
else if (document.layers){) P, c- d% [( Q2 z0 }: R
if (ns_marquee.left>(actualwidth*(-1)+8)). |* Z8 E4 x% [" o6 H+ U
ns_marquee.left-=copyspeed; K' y8 T5 ?( Q. Z' P
else
! m% s3 U5 p* p4 f* s3 l8 x2 Hns_marquee.left=marqueewidth+8+ g0 o( K& A0 {5 \" u6 D
}
4 J$ Z; w4 ^9 |' z8 \}
% A0 m4 D( j. M1 W2 {. j
( v$ e$ e' P2 n1 N7 _* }# V; y! c& iif (iedom||document.layers){
7 N# w4 d4 Q' E8 @ f' _with (document){
! D; S: w3 D. | Y5 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( h8 m$ P g8 R* q% C: k6 d
if (iedom){
" Y$ X% u" k9 g! Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' @ x$ W. t A; E- @, Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 H6 j% N( e# @# U. X' rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 e8 I- O' e$ O
write('</div>')
% Y7 L+ ~7 \* J! P: V0 } V! O}# J0 u+ ~1 B! x* l
else if (document.layers){
# @# D: W7 p A! s# u3 Y9 N0 v8 B4 G& Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 e/ L/ B( {8 {7 n* hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( p. E% W# X% [- |4 u% j: Uwrite('</ilayer>')
' i" D, G! A6 q. k0 C! M4 f; O. K/ z}
7 l2 b* l6 ~3 _document.write('</td></table>')' Q, g$ W' p) u$ l
}
+ `- L. m- R) z/ M8 c}/ _. B6 @, Y% ]4 H! Y
</script> |
|