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

|
网页之跑马灯文字特效
//修改宽度! R& }$ k. D& o* \; @
var marqueewidth=300: c3 y8 [! ~# l; v
//高度
! D3 D1 D$ K' `" @' w$ Mvar marqueeheight=259 J3 d% {4 P0 X( _& H" u' l. B
//速度(1-10)
1 V) y0 s' n0 n7 v4 N1 e2 mvar marqueespeed=3
0 I# h9 |6 U5 D2 V//背景颜色$ `% s1 I- L, {) m4 v
var marqueebgcolor="#FFFFFF"8 e& n+ Y$ u% N* a
//是否能暂停 (0=no. 1=yes)?- D8 L$ L5 y+ n! N' F+ d
var pauseit=10 I/ K" F4 ?+ c4 D
' d4 U* L/ \, e/ ?$ j
//修改显示内容% V4 t d+ x$ A6 ]- p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 Q3 b9 J$ }, Z6 Y; T; U
' O2 t* L( r( l0 r5 d. ?$ w/ H* D/ w
6 D6 _1 x% C( m! }8 ^0 I////下面不需改变////////////
! i. m) Y+ E0 ^& t( T- o' r3 O6 e6 X
var copyspeed=marqueespeed) ~7 m& b! c& Q; `
var pausespeed=(pauseit==0)? copyspeed: 0( C* H4 H# g1 Q: n, M9 e1 F
var iedom=document.all||document.getElementById9 \$ r% y& }8 I+ h9 X3 R( D `
if (iedom): U/ h8 a$ t3 s: K) A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% q. X6 Y% Z3 d- { N2 ?6 T# H( nvar actualwidth=''0 Y; n( s& ?7 E9 y# ^( h, \& B
var cross_marquee, ns_marquee
' |7 Z k& e- `3 C3 c; J. W) y& L. M! j% ^# U5 }7 F6 d
function populate(){
. v9 F! l6 m( Y. {# E! Y5 nif (iedom){3 K6 l8 _* l6 c+ R( D; ^9 `/ D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. y; u4 J7 n$ J) ^: ~( @% s
cross_marquee.style.left=marqueewidth+8+ r' J' K' i* M6 b3 W- Z
cross_marquee.innerHTML=marqueecontent. C; q3 P! r- S. X" w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" E9 a( n1 A) a" A}
$ T# i2 y( q; O- Yelse if (document.layers){
. J4 I' c7 c4 ?! q/ q, K' E4 ?ns_marquee=document.ns_marquee.document.ns_marquee2
) S9 M- S! n; X Ins_marquee.left=marqueewidth+8( Z0 b. Y, W% @7 F j, n6 I2 q
ns_marquee.document.write(marqueecontent)
6 u# y# m- ?) A: X# Jns_marquee.document.close()
: W: B4 d9 k; G1 v( d, Hactualwidth=ns_marquee.document.width' A& _2 m+ V) ~8 V$ N; y& c3 C
}
6 h: u2 T9 J+ ^+ ^3 rlefttime=setInterval("scrollmarquee()",20)
* d7 @1 R( A; a& }5 [* ~}) F$ A& }7 M, P; t* w
window.onload=populate4 V5 G8 a$ _1 g: P" A6 W ]& k
! T q8 T7 i+ a1 u7 lfunction scrollmarquee(){
: R6 g( v/ {, ]' N9 Sif (iedom){9 v2 M5 {% H0 G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 V! }! U+ J% _! a% Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 d1 {/ i f- m( {/ u6 M
else
7 c/ V; @ L9 J8 E2 W& {. \6 p9 fcross_marquee.style.left=marqueewidth+81 G d# x# J" W/ z+ o- `
* Y; k: l$ S7 d6 @1 y
}
' T- O& Z' {: p& ~' Q! delse if (document.layers){! r8 o: o: B3 x$ ?2 ]
if (ns_marquee.left>(actualwidth*(-1)+8))+ I# _5 O. ^5 W6 J( t( Y, ^
ns_marquee.left-=copyspeed6 U1 D/ e) A) l1 `# h0 Q, J5 w
else
5 W2 L' @) w1 \& T& N! v+ H$ o& K0 ^! fns_marquee.left=marqueewidth+8
3 f* d% o. D2 j; I}
# B N( ?, v, h. n! O. s}
! h8 Z1 t* q8 z
/ A6 X0 d U7 T% t% Eif (iedom||document.layers){
/ d# {' l! B7 z. V1 p" swith (document){
1 T9 B% h, i/ G" v4 w* Y5 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>') m; T* m! d- Z' t' x
if (iedom){# [$ q2 x6 N @% Z$ m0 U2 g9 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 n E, S; o' T* h, D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ ]6 X/ Q# I3 h& Y. b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( |# J8 V. ]8 C, Q4 ^$ A: Kwrite('</div>')
) f# }$ a7 u/ O' e}
# a+ x8 }8 j$ Z4 F" [5 ?else if (document.layers){2 h$ o6 I8 y* Q j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') N4 ?6 B, {* p" N. X5 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 t( T/ q# `) D
write('</ilayer>')
3 x: c: d; P$ a7 n$ Q}
, L$ f/ Q4 U! Y' y" C8 W: U) ldocument.write('</td></table>')4 y Q1 a; P3 N+ v3 Y# I
}2 q8 }" x# B0 e. U$ ]- e- E; U3 {
}# M5 T1 J5 c+ p/ u
</script> |
|