返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 h3 l3 I+ E  z: d% q
var marqueewidth=300
4 e, V% q" b- J3 g2 }: k8 i//高度: g0 r6 e. `$ p7 o# V
var marqueeheight=25
" K% K- q' t8 ?2 a7 j0 R2 G# {//速度(1-10)9 D+ y/ B4 z& N0 E' C& E
var marqueespeed=3. b$ d* c0 F( w' s
//背景颜色" h# n; ^  ]+ f0 d
var marqueebgcolor="#FFFFFF"2 I' ~4 w* N( |: N) d  B8 ]- |
//是否能暂停 (0=no. 1=yes)?; r7 K  j3 y8 K! ~4 w8 @7 p( Q
var pauseit=15 n2 O; C2 ^) I, S7 t# J9 O) r4 v

, d7 F8 _8 t# w5 L8 s9 C& c. v1 a( E//修改显示内容
) m* D( l3 e& A7 K/ a/ K% Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 M/ n. [0 g# ~5 z4 ^. o+ ^
" z! {4 H6 y( d, \' o. t8 t- n# d1 M
////下面不需改变////////////
, G5 h. X% E; U! g
( T2 P  G1 m  u0 Nvar copyspeed=marqueespeed9 V& b0 ?: m2 t, B; ~- K# a& l' r
var pausespeed=(pauseit==0)? copyspeed: 0* U* j0 T' A7 J! _+ [
var iedom=document.all||document.getElementById
4 Y& O! P! ^7 X$ N  h- oif (iedom)
! \3 c4 a( ?) e3 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; K* d& Q5 t0 V; m0 zvar actualwidth=''
5 L, A$ I9 C# ]1 j8 |, `6 Bvar cross_marquee, ns_marquee
# J& V- f" Q1 B/ W6 p) Q& G) r- A
7 A: L& W( ~& u- T1 ~0 V% lfunction populate(){0 Z) b+ K8 m" l6 |! G
if (iedom){
' T. n: E* c. c& S# F, p0 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 @+ g5 X9 a/ O' L" tcross_marquee.style.left=marqueewidth+83 K5 x3 f/ ^* m4 W$ D" ~- Z
cross_marquee.innerHTML=marqueecontent
5 n6 j, v4 N( wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 q; `8 i$ P: }# U; r/ {}
2 E0 |; g6 W6 P+ ?! S3 u. j4 @else if (document.layers){
# G% D" z; H. L# Nns_marquee=document.ns_marquee.document.ns_marquee2
- s, P* n! V) [7 Bns_marquee.left=marqueewidth+8) i! |) }) }" h3 j* T
ns_marquee.document.write(marqueecontent)
2 ^$ Y" r# R1 U- O0 T6 x5 j8 hns_marquee.document.close()7 I+ C. r3 a1 o" r( o
actualwidth=ns_marquee.document.width
; o) l- T2 S  U  F4 \% k+ i}! O, P! x7 @1 x* `
lefttime=setInterval("scrollmarquee()",20)
' @$ M5 N9 P& V}5 n1 r9 \4 A* N
window.onload=populate
3 J& e5 x  Y% b! |) d' a' m' c  W$ l. P: b( w5 {/ [: x+ q. N
function scrollmarquee(){
- U; \& a3 g2 A* lif (iedom){
/ Z- Q7 ^) I3 x% w. zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ t! Y$ C5 S8 F5 C: |; |5 P# }
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ z( s& |3 V- U/ K  selse1 }  K0 S( N* I0 y" [
cross_marquee.style.left=marqueewidth+8) @  K% U( r6 O, d# S& x& k

# j4 d6 V% w8 `2 O* G}- k6 j: Y6 r/ M7 @5 z( Y7 x
else if (document.layers){9 M5 Y$ H/ W  A7 ]5 ]& E3 _- s
if (ns_marquee.left>(actualwidth*(-1)+8))
' B! h. J9 `* h$ x/ E5 pns_marquee.left-=copyspeed
" D* l* I& R/ W- ]else9 D% P- F8 F' @6 E
ns_marquee.left=marqueewidth+8) W4 W9 o4 @2 G: o+ e8 g* F; H
}  ^) g& i& f4 o5 h/ ]
}0 h( A& Q; j+ d$ c9 _" m

) ~( F6 \1 s0 i0 _( _if (iedom||document.layers){2 E1 T# j* E; m3 h; _2 I2 B
with (document){
, l" M5 T& A8 W& Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): i7 i; M7 c* A) {" W
if (iedom){7 W( F9 ]- T. ^6 ~$ z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 |7 z0 m: ?( b+ B7 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( ^) J& B1 p: Y0 F" F9 g& }: _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  L) C% n2 `5 B5 u- ]write('</div>')
& k- \* q( z; h}3 w8 z" q) `" U1 b* J! j. f
else if (document.layers){
- F: L  E# ?7 v& X0 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% q1 T7 B: I" r7 H' C* }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ M" }) O  o4 |9 c( L+ r( vwrite('</ilayer>'). B" g) w* y+ u; f8 E/ t
}
: s% P* r1 l6 Q+ ~3 p+ Tdocument.write('</td></table>')
& N) D# d9 S1 n6 y7 v/ {}
5 t/ O* }  ^  y* T}
+ K/ A% G" F5 X( \4 Y: T* ~- [</script>

返回列表
【捌玖网络】已经运行: