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

|
网页之跑马灯文字特效
//修改宽度
0 T0 p5 }' x4 _ B8 ~5 ovar marqueewidth=300, F q2 z, R4 `: o5 p4 E
//高度7 p( u8 B6 ]; Q. A
var marqueeheight=252 N% q0 A5 W3 r! M5 j( U3 ?2 i I6 c
//速度(1-10)% i" n" R4 y Q
var marqueespeed=3 l. U# y6 }7 y& M, W5 x/ J
//背景颜色' e3 C/ g5 `5 J0 O0 R
var marqueebgcolor="#FFFFFF"
" i4 A$ g1 x+ Z$ E& a Z3 ]8 z' `//是否能暂停 (0=no. 1=yes)?
4 |( Q# R. h1 {" X/ S" Q: D; a& ~var pauseit=1
5 Z( W2 ^/ W- P: _
6 u9 o" \% R& H5 a i7 N2 S+ q//修改显示内容8 \1 ]% i" y1 I$ r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 H" I( P. b: G3 q8 m. \
! c; U# A' Y4 U' G. P1 m! B+ \# ?! v& b
////下面不需改变////////////& I3 {' Q) f( e8 E" S$ C% i
) ~' Z- }: }& P7 k1 a& p$ j+ Y- P
var copyspeed=marqueespeed' c- A7 @9 m6 {3 C
var pausespeed=(pauseit==0)? copyspeed: 0
( v" A# ]( n3 n; i+ g1 Q. yvar iedom=document.all||document.getElementById
, w1 R" m1 E2 ?9 Uif (iedom), j2 b8 {: R# n, p0 N4 s g( n. P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') x1 V# Z8 G5 n
var actualwidth=''
, ^, ^' s* ~6 V/ @4 H) h; nvar cross_marquee, ns_marquee& p+ K: n( s* y; e
3 ?7 [) X, Z2 I" jfunction populate(){* m7 M `, a+ X a( {
if (iedom){7 F( s( N6 A& u. j. h! S4 R/ j* B9 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' |) z9 W8 E& _6 d! ]cross_marquee.style.left=marqueewidth+8
# i, [8 C# j2 B! g8 O. {cross_marquee.innerHTML=marqueecontent( K+ H: d, K# d- P% V- L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: _4 n8 G/ T" ?8 O6 Q4 V
}$ v; w u0 Y" t( ^
else if (document.layers){4 D' Y' P* ^9 X* A
ns_marquee=document.ns_marquee.document.ns_marquee2
3 q- ]% {5 s9 zns_marquee.left=marqueewidth+8
) P$ F0 ~6 `+ d( r. g, O' fns_marquee.document.write(marqueecontent)% [5 ]+ H( [. ~. o% z
ns_marquee.document.close()
& ^& s( K0 f1 y+ V/ Q; Tactualwidth=ns_marquee.document.width9 \, s, j! u9 d) E. ^, ?! x
}+ ^. ~) `* x3 C0 V" T
lefttime=setInterval("scrollmarquee()",20)5 g1 B' m: T/ t2 e6 R1 X6 Y
}9 G$ y) H, B; o c4 Y# X9 c% l
window.onload=populate
. M( w1 W! }8 I% ^8 Q# ^8 `( m" f2 \8 b' n- F9 G
function scrollmarquee(){
- f. G# q# s$ N4 w* D6 Tif (iedom){
* E3 y3 q8 O, {9 ?; [% U6 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, z. g' @- l4 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ v' d% H8 i! s( O) w% ]else7 S/ U8 ?; ~) n3 ?& f
cross_marquee.style.left=marqueewidth+82 c. C& v' ?1 V1 } z
b$ W; ~! B% l( `}: J% T3 b& ~# `+ l% u6 ~
else if (document.layers){
$ T' n- G% W# U& T% e! E; U9 [4 X7 Tif (ns_marquee.left>(actualwidth*(-1)+8)): V9 ]8 n. O& @! |
ns_marquee.left-=copyspeed9 A+ e4 @- W5 J, m. g
else
8 D o/ w) @1 ]ns_marquee.left=marqueewidth+87 x- Y& H: g/ t
}5 m( E& r# T# E6 I
}
6 i; H+ u. i7 s4 u. j" S' ?. F. K2 Q5 }% }' D
if (iedom||document.layers){
* |% `, d" G* Twith (document){3 H5 j7 Q) L* \9 L3 U" v& d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% N7 }$ H/ B0 e5 v) L
if (iedom){
* m. b2 P* s5 d# u. Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" F$ v' J' ]' p; k* Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ G2 x9 z3 C5 w# w6 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( H" ]/ l2 p" s5 S- v: |
write('</div>')% G# T% s! [( l& A+ Q- H% `
}7 Y* R( `! ]& x4 L' h0 k8 Q
else if (document.layers){
& z& {, @% A$ X5 v" d2 O, M# ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ S2 p2 P) v5 H0 X" f3 B v" S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') y6 S7 u5 m- y
write('</ilayer>')8 s( U' `! i9 I1 N; @
}
+ v8 U$ ? N2 B! f) }document.write('</td></table>')
, W4 U8 J1 |/ |, W- {. H% m6 j}
$ t6 |* R& {* v$ Z2 u}7 u' O/ T' F( B. x9 f. ]. {8 f# O
</script> |
|