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

|
网页之跑马灯文字特效
//修改宽度. ~5 ]' G) O" x# V8 L5 Q. N( m; c
var marqueewidth=300
/ ?0 H2 k( X% r U; H$ M//高度
2 l, K1 |, M. H% o* ]var marqueeheight=25
( c3 b$ q4 m% I5 x/ P5 p' _//速度(1-10)2 h) h9 I9 d. z" m; e& o& \
var marqueespeed=3
. Y0 @7 E7 r/ h//背景颜色
. u! x9 G2 E: l. J4 `' yvar marqueebgcolor="#FFFFFF"
( @, v* F* z0 i+ {//是否能暂停 (0=no. 1=yes)?' g0 a h$ I. @. @0 a9 p% D+ M
var pauseit=1
' ]0 B4 w9 D/ O2 C$ J
/ {. {6 b9 o( g6 ?7 q//修改显示内容9 M4 J+ C4 ~4 h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 F. y, ~/ D8 U7 O) L+ q: v3 M
4 g! v) }7 T8 _ o& v9 a( M0 H4 h& O3 H N. s% h( D% A6 C
////下面不需改变////////////
* h- m. S* t y; u% j/ |' [9 }- H/ x: q, M; n% y
var copyspeed=marqueespeed
3 z7 a. I6 U) C9 Yvar pausespeed=(pauseit==0)? copyspeed: 0
4 l7 c8 Q6 [ @; X! f; jvar iedom=document.all||document.getElementById
! e" q7 C0 ?. u0 ~! E. ?' g# Sif (iedom)3 _% S* p! W m8 X, i( E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 N( J( h' F; c9 B
var actualwidth=''
9 ]: v' [ V% ]var cross_marquee, ns_marquee
h- m: Y- [" ]- [% E8 `# q# @* X7 r0 L" b8 _. |/ y
function populate(){2 G; a/ r& w6 d
if (iedom){
c6 [) U' [2 P7 @; V% pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) o; f4 t7 g1 k4 q. P, A
cross_marquee.style.left=marqueewidth+8
?. J+ v5 n: B8 X# ^* k" Rcross_marquee.innerHTML=marqueecontent
+ S5 s E3 q# ]; x2 g8 Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 Z5 O ]3 {! @! e5 h}2 k. N& h( {! C
else if (document.layers){
( |* ^, B0 o3 p: t# Xns_marquee=document.ns_marquee.document.ns_marquee2
8 U6 W6 L) W/ t& m* rns_marquee.left=marqueewidth+8
`' f1 ]1 q3 o# d8 cns_marquee.document.write(marqueecontent)
+ N' q- C$ R6 N/ u) Z( Rns_marquee.document.close()
1 y/ k5 U1 j3 E5 O3 A. |' Mactualwidth=ns_marquee.document.width
- O' V7 H2 ]9 \& }: j) p2 n4 p# l* g. T}! i) E) l$ N. k" |
lefttime=setInterval("scrollmarquee()",20). j. P. S$ J$ E) r
}- _- A1 a' x) {- g3 w8 R+ r
window.onload=populate
! ]3 N c- i. w2 a. |3 }* \' n' f4 H7 M* ?
function scrollmarquee(){ H6 b; @) ^8 q- _# X
if (iedom){0 w& F; Z; ~$ t" M7 Q6 |. D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 h# [: A$ c5 E/ C1 r7 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) m0 j! x. Z1 h/ z( Y: _4 U7 `1 m5 A: }- n6 lelse
" p" K' m1 J7 ], [& Q! @cross_marquee.style.left=marqueewidth+8
! f3 n O1 G M' Z& p* F- S# R" K2 d" z; t6 ~1 X
}/ U) r$ b' q4 t7 P8 h2 p D% k2 b
else if (document.layers){
6 s3 d, `- j: `3 O# wif (ns_marquee.left>(actualwidth*(-1)+8))
% E5 r8 R4 G# Ons_marquee.left-=copyspeed
+ J6 } C$ ^, u5 m- l3 i2 jelse
* r" F) n# z& c$ Ons_marquee.left=marqueewidth+8
5 o( K+ T4 _% v}4 p: U6 D- X; w
}
# v, C* t; r+ b {- e4 i" y6 _7 f3 n2 h3 M. O/ T( T1 M7 H# t
if (iedom||document.layers){
3 f6 {1 ]' _% s9 u T" [with (document){/ }6 N$ ?2 V* z: b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" h6 j1 G; {8 Fif (iedom){! ]. k9 z" q B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 a- M u1 a* W5 a2 s: c2 Y' awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, y; u2 L1 s; A5 ^1 ?) mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') d0 I3 N# r8 L( N
write('</div>')
! H U$ D3 t, N5 k9 f# D+ X, R}& V, H$ s+ }$ h
else if (document.layers){
* Y; l& I# }' v* lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( z9 {8 X. v6 ~- L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 }. I1 ] l1 t5 y. Rwrite('</ilayer>')) ~. D) O- Z' p( ~
}
1 c0 ~4 X! [, s9 D4 ]2 n/ A7 hdocument.write('</td></table>')( z& Q9 e) i+ Y# E4 @8 J
}! N* H+ j! ?; y2 g1 ]( M+ ]; z- D4 K
}2 O( h/ w" p, p0 v& @
</script> |
|