返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  C" X7 m1 Q7 ^+ n9 evar marqueewidth=300
2 P; s: I# j2 P//高度, A& Q. ^" d' G0 u  G* `+ g* E
var marqueeheight=256 _& \, w6 Z5 W8 ?, V
//速度(1-10)6 T/ A1 m# J/ V% H6 p6 h9 D4 _
var marqueespeed=3
. z, Z6 j+ s0 ?7 n2 p' A) N- ~//背景颜色0 {- F2 D* _$ i* Y% V& z
var marqueebgcolor="#FFFFFF"! N3 K" T( {1 }* G1 X( \8 L, W' ]
//是否能暂停 (0=no. 1=yes)?
/ U- l0 X# G) B# Bvar pauseit=1
8 I: r" w/ ]$ ~5 ^! A: C! H
0 F. {4 a, t# U9 ^1 _. i//修改显示内容" _% A1 h7 a7 E7 n' [! M) A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 B# ^. F# m& K2 F6 Z. X2 b
2 @3 \) f9 P. z! K+ q2 R2 X6 p- a3 ]" H5 [
////下面不需改变////////////, `* }; e! V; }+ z
" W! j9 n8 r% K- e, o; C/ I
var copyspeed=marqueespeed
5 D5 `4 m$ E& ]+ d  xvar pausespeed=(pauseit==0)? copyspeed: 0
4 j' y. D8 x* q) L7 ^5 S! u& mvar iedom=document.all||document.getElementById: J% D. c: m+ Q0 @4 e" I
if (iedom)* x6 k% f) }5 M) U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ U) |9 E6 L* rvar actualwidth=''$ v0 ?/ n* R4 Z) h$ Q2 g
var cross_marquee, ns_marquee
& K! L- G8 U& F4 A( U5 [4 p' J" W, B
function populate(){
; |) w! {! Z) j$ i7 f/ A) oif (iedom){
+ v" h+ {( w$ ~. Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! b8 b0 L% N2 K. V1 k& `, j; k
cross_marquee.style.left=marqueewidth+85 v$ d9 a  Q- s0 q2 D( j
cross_marquee.innerHTML=marqueecontent
! X' T7 {# b8 d9 m# gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" f. ^- X- P' f' ~' D& @}* j  T2 _# n+ j% L7 K" z
else if (document.layers){
1 B0 V: f7 F: |8 Sns_marquee=document.ns_marquee.document.ns_marquee2
, _' V  B1 @1 v* x: zns_marquee.left=marqueewidth+83 c- A) C; O# ~6 `
ns_marquee.document.write(marqueecontent)
" w) {2 J: I9 l9 J4 qns_marquee.document.close()
, g" d$ u4 x+ }# V3 a  Pactualwidth=ns_marquee.document.width
, Y& k1 F$ l9 F; x. T& l}
6 d4 Y! V8 Q8 s/ zlefttime=setInterval("scrollmarquee()",20)- m( ?0 r/ e- `3 ^
}
7 Z  W/ Z7 j3 P. d( _7 Fwindow.onload=populate$ _: f2 n$ n$ f% ?* i: y6 X$ ^

: C$ y, }, Y! U2 E8 F5 L! V3 nfunction scrollmarquee(){
7 f1 L' R2 X7 z+ J. h7 w1 gif (iedom){
% }5 S7 J% `$ h% G/ J* S$ D: Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ u% Z4 W; A( D* lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& I  \2 _$ p& o! Q) jelse
: c% m& A, j7 h# l* [" fcross_marquee.style.left=marqueewidth+8
( Z5 X" u2 W, {! _+ o% m2 O: O
- X8 f0 z+ Y$ K% V; s+ a5 ?% E}
5 y3 F1 e, m! b0 A+ O  kelse if (document.layers){
  V" ?; L* \1 W' g4 H2 |/ F! aif (ns_marquee.left>(actualwidth*(-1)+8)): D! E' A1 L) W' K+ V/ t
ns_marquee.left-=copyspeed
2 z5 ]1 R, ~2 Z2 {( R0 B5 V% L: melse
  \- o, k) e; {* |/ N3 }ns_marquee.left=marqueewidth+8+ F  e( ^5 p: C/ F0 K( o. j
}
* P1 j: s0 x7 N  |+ |1 E}
, _) Q7 C3 s8 s) F% l1 {: m! M% `" J
if (iedom||document.layers){
4 s: \$ \" h. k1 Ewith (document){
6 [/ J, A& c- s+ {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ F% b! k$ W. dif (iedom){2 L3 B  l, h8 n6 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) A2 a: Q8 I, v3 l5 S0 Z- Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 \# @& F# c. U) P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  L7 i' ]# _' \. m) Q! I% ~write('</div>')
1 y1 d& V  Z( {2 k}
+ p& l) f) E6 y& \/ y8 K7 melse if (document.layers){
# P  M$ k: D* f& V# A- Y; Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& ]7 S; S9 g8 P3 b! X6 m& L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& @+ H- p8 X4 w! w# D) [8 |
write('</ilayer>')3 _* \2 n- I2 n+ z3 A: \* ~
}* H  u8 k9 l1 x' _' A' ?
document.write('</td></table>')
- d8 O/ b9 q& p+ ^4 M5 G" L9 W1 P, D}
$ |. L: K* E( l8 P}+ b; G$ @  v# T+ |8 i
</script>

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