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

|
网页之跑马灯文字特效
//修改宽度- u- \' X4 o3 u6 k {! _( U: e
var marqueewidth=300
/ U# b. Y8 \+ R* U/ i//高度. ?9 f7 G/ d/ k/ x1 T# x1 M
var marqueeheight=253 n! a- G& E$ b
//速度(1-10)$ b: S9 q0 A6 y+ M7 q2 |
var marqueespeed=3
; A* M8 P4 O5 i2 s, b( X! n& L: @6 K2 _//背景颜色$ i' M7 ~) O2 a3 G C; s/ N6 M
var marqueebgcolor="#FFFFFF"
4 e W& ^" t' |8 v//是否能暂停 (0=no. 1=yes)?
) v: ^6 W6 G6 {2 kvar pauseit=1
: h9 U* m! F* J* ^* Q3 D" }; Q; |0 }
//修改显示内容 D4 U3 k% b4 p+ t- M) y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 Q% [7 V j( x% f- B! z5 F/ X- H$ t6 r% h0 T" j( V
7 t$ m1 Z' b) z8 j" P
////下面不需改变////////////' C+ c0 O: ?3 E7 X
; q5 ~# A/ r: x; [7 ]" M X, hvar copyspeed=marqueespeed
. ?2 U% e& k0 R4 N9 `- |var pausespeed=(pauseit==0)? copyspeed: 0' _5 A6 f/ l6 p" i2 Y6 Q- N
var iedom=document.all||document.getElementById
, J" N3 Y9 E y4 ]; b; F9 vif (iedom)
% ~0 ^* t. k; o/ Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 Q- d( o- g3 f- w3 [/ Tvar actualwidth=''3 _# m U0 u5 {/ o! s7 i
var cross_marquee, ns_marquee8 z! s- q! S" G$ l) _3 y0 |/ Z
3 v; w# B8 X Z
function populate(){1 r2 K# a5 S3 q6 @& ]. }
if (iedom){2 c# ~9 s2 s1 \+ O1 a: C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) O$ J/ y6 I# Q g/ ~7 k) I$ P* f
cross_marquee.style.left=marqueewidth+8
8 ?/ t8 g. p' y$ O8 Hcross_marquee.innerHTML=marqueecontent( _( |% C G7 r! c) g# I8 ^ D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 r% s) m4 L9 k0 d& u: U}, C% y* T: M e) R6 T* Y
else if (document.layers){
1 l) q* n) u" [& d* [$ Vns_marquee=document.ns_marquee.document.ns_marquee2
1 w$ Y8 Y% E* x/ |4 G# D. Ins_marquee.left=marqueewidth+8) O) ?" K! A$ h; Q2 j& I
ns_marquee.document.write(marqueecontent)* ~" u1 K4 C; [ L- U) d* _
ns_marquee.document.close(); H' ]- I' l- p7 X2 b+ t k3 f
actualwidth=ns_marquee.document.width
8 O' D# F# U' j- p/ f* `}
( d# _6 e2 W9 ] b; {0 O( I/ Blefttime=setInterval("scrollmarquee()",20)
) b. \, S3 @9 T}# _6 t, V5 E& X. g8 ?+ H; {* i
window.onload=populate
* W* g' ~4 ^3 P) J% ~
: `% |5 N0 v- n, d5 j: Mfunction scrollmarquee(){ g1 Y7 Y$ c0 z1 E/ M) O) O
if (iedom){
# e6 I. Z2 M3 n$ g7 vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 [# v& I& U- |1 n6 ]( d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 d, g# s: @. {
else0 h- m5 t6 U7 w3 N7 W$ S
cross_marquee.style.left=marqueewidth+8
+ C3 i/ V; y3 f4 y+ C M; N5 q3 }3 m+ x k/ x7 \
}
: X" T9 ~4 N: F5 ]5 ]# a8 T- ^else if (document.layers){
2 e# @% V# c9 k2 m! fif (ns_marquee.left>(actualwidth*(-1)+8))
c: S8 _( b: y0 R, e8 {8 T4 k& \* A8 ?ns_marquee.left-=copyspeed* N0 K, p' D% k2 p0 E# j: ^2 b0 a
else
( t# ?! j: d/ k% E- j3 Nns_marquee.left=marqueewidth+80 f+ V4 A& }& g, w- o
}9 q9 Z a5 R8 d7 ?0 |1 e
}! w* W5 x$ a, |, Z* j j
* a6 {. e% g! f# t4 eif (iedom||document.layers){ S& L2 g& V" _. ^1 A
with (document){7 v1 {9 F1 c: J W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- J0 W r4 K5 x0 P9 m: L0 a
if (iedom){6 V. ?! r0 U; `+ [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 M: u; H" N* K$ G, F7 s) q- W' Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 c1 p# c- W! {) vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 h4 R0 Q3 ^3 z- }7 d3 B
write('</div>')) ?4 N5 S3 v0 H0 b5 P( k
}- a/ [. p2 p$ Z
else if (document.layers){1 S/ o" ?$ o7 |$ w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% a& w( H; P8 u* Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( e) g4 K# @2 _, W8 T. Rwrite('</ilayer>')/ ?' _+ u; k, m/ ^0 {2 C( g
}
4 ?2 D2 w+ v1 t1 b D C) d4 Odocument.write('</td></table>')
$ D9 r& T/ f* h& X) l, y6 ?) H}% R0 N9 s/ D# A# ?& x
}, c# g9 C7 J* s+ N) I; t
</script> |
|