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

|
网页之跑马灯文字特效
//修改宽度
! B5 i5 i$ _/ zvar marqueewidth=300
! k w7 b7 T4 ^: E: A% n3 K0 W! ?( \//高度/ Q9 r" l# Q" V8 u3 S
var marqueeheight=25
2 `( Z L, f) Y//速度(1-10)
* d9 n# F1 S# Evar marqueespeed=3, v: h2 o9 i) |" F: r
//背景颜色
4 L) V. B- Q2 }1 s" L# W6 Ovar marqueebgcolor="#FFFFFF"6 C9 V) r9 M, D1 t ^8 g
//是否能暂停 (0=no. 1=yes)?0 w/ H) A/ K$ U
var pauseit=1: v& e0 Y8 v4 e) ^' O
) V5 K9 j O, y
//修改显示内容, D, l0 E9 n o1 l4 d8 L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' Q8 I r7 D' P7 h: p& l0 [( s+ [3 G( M e. k% Y: K0 ~
, e N X; E' @5 m////下面不需改变////////////. t7 ?; J1 v' n
$ t6 k& s) O; n& O' G1 pvar copyspeed=marqueespeed+ e7 E1 k Z3 _5 }& z) s0 c
var pausespeed=(pauseit==0)? copyspeed: 00 o1 \1 K2 }% G( v: [1 O+ L" w
var iedom=document.all||document.getElementById
2 I" A% _& C( D0 g0 j1 Eif (iedom)) e. R: Q7 C- h7 j( C* s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). S/ s6 Q4 W2 f |
var actualwidth=''- ]! F2 H, p* T6 ^2 h* N% `# L/ H
var cross_marquee, ns_marquee
' K) E) }- b+ E$ @$ b" N) ~' Y% Y3 D {
function populate(){* l4 a3 {5 w- P8 a2 I( V+ e& S4 q
if (iedom){$ \+ V1 R0 Y9 }7 T& {; b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) ~+ b" s- t8 a' Vcross_marquee.style.left=marqueewidth+8/ Y. V# X( u+ W0 s2 N
cross_marquee.innerHTML=marqueecontent
' w0 A, k9 S- |7 g: J8 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( U' c4 ?: q* b- W}+ h% j. z' z$ ^4 z5 P& s+ i
else if (document.layers){( B1 F! i, c, H7 @ i
ns_marquee=document.ns_marquee.document.ns_marquee2+ _. _: A6 l8 y' q+ ]
ns_marquee.left=marqueewidth+8
) T. ?5 {, V0 D$ l4 J; f8 M) rns_marquee.document.write(marqueecontent)
% I" a3 Y4 d0 c" c6 Ans_marquee.document.close()7 T6 u5 a3 L! t: P# L8 J" @! f
actualwidth=ns_marquee.document.width$ g# D5 F5 | ~! `
}
9 k4 O" p8 v5 ^0 F8 i( X4 tlefttime=setInterval("scrollmarquee()",20)
( A' w! g+ G8 [% L. H3 Q}5 `; @, y( g! U l( T
window.onload=populate* l7 Z0 z* V3 b9 ~
- S) ?, u* P# T' Q) h# u
function scrollmarquee(){' p/ J5 w& p" C* ]3 ?0 S$ t' w# g% n
if (iedom){
1 A$ n$ e- o+ r& Z4 A+ q- w( d3 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, t% s; g' w' F0 o% f& S+ C- Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 Q; H6 @# r4 e9 }( _
else" A/ R( t K1 e& q4 }
cross_marquee.style.left=marqueewidth+87 ~: v5 i9 g+ }! K
! D0 e; d* n6 `, E; u+ D4 l
}5 A) [! }, ]6 x' E F W, q
else if (document.layers){4 Z* u# \5 ]2 d
if (ns_marquee.left>(actualwidth*(-1)+8))' o: A2 m) x. g* C( N- C
ns_marquee.left-=copyspeed
( T5 j+ {. z- pelse
: W6 Y9 f: D9 `) o/ kns_marquee.left=marqueewidth+8! j+ p& G/ n* f: Z2 r; v/ n' a% w% L
}
5 ]% Z( i W" C7 ~7 B}5 q+ T5 k9 r, n. ~+ F' n$ A
- y; ]# B1 l: _+ d% V+ A
if (iedom||document.layers){& B: ~7 u" Z8 `7 h1 e, v
with (document){/ Q1 e, c8 ~' h* m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( R9 G, S: B+ Z6 Y4 Eif (iedom){
3 \4 ^; a/ s3 Q. L( v4 R+ w. vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" H' ^* ^; W) @* N# X0 h! H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- A. V/ @: @( e- ~1 W5 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- O9 v3 d& }8 o. j5 r9 C
write('</div>')
4 N# u0 U: }5 m: y5 M M}
* H3 v* J0 o2 p% a3 Selse if (document.layers){
( R- x+ I7 ^2 u, U7 \( @0 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 T: |5 {9 o; Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 O9 g/ t4 Y6 |5 f1 [0 Nwrite('</ilayer>'); R: i; S7 \: O% S
}
* p+ w( ]) Y- I) bdocument.write('</td></table>')
2 F1 S8 Q7 o2 U5 ^} G5 G; Y9 ?$ R+ G! [
}
* b/ u/ a* V" v( R% `" k% d" ?</script> |
|