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

|
网页之跑马灯文字特效
//修改宽度
4 R8 q% y/ E! f2 @$ r5 ~/ o. Wvar marqueewidth=3008 i9 e7 |5 }7 Q* ^7 c; {2 m& C
//高度+ ~+ m, Y2 N! W J2 o0 M
var marqueeheight=25
7 ?0 `, U j; Q4 u//速度(1-10)
$ A, v% R) G) p6 _* mvar marqueespeed=3
% E& p% h6 z# E4 E; p- M+ P2 j8 H//背景颜色
( d: K1 I0 d7 b: C+ I' Gvar marqueebgcolor="#FFFFFF"
1 W6 q6 ^4 q0 r! {" F# \( K7 q+ t0 S//是否能暂停 (0=no. 1=yes)?, R9 A% Q9 j9 E( y7 ^0 O* t& S
var pauseit=1
! o1 p9 @% N1 p4 q6 |
0 i7 g' G, i6 v- {" {//修改显示内容
3 e1 I. |! E% ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* P& c3 f2 |# J7 J/ o+ e9 P9 n) U* {; X/ b m0 L4 A0 Z u2 t
x4 a: {$ Q) i% V////下面不需改变////////////7 I* w; A5 v; i2 C
& d) `* J9 u S& n9 ^var copyspeed=marqueespeed
- h8 i$ J% V6 r4 wvar pausespeed=(pauseit==0)? copyspeed: 0
. t3 b4 P" t0 R: @1 [4 j- ovar iedom=document.all||document.getElementById
; a9 f5 z" ]3 z9 uif (iedom)
7 W k- M" j' O3 E7 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') [+ ~" w+ M! s6 P" }8 E
var actualwidth=''. w, S( f9 e7 @; k. y9 f- O
var cross_marquee, ns_marquee* p A7 |8 y( z+ z2 l2 z5 d
( T0 p' v& T2 r6 k" m! ^$ P
function populate(){5 Z8 \& T: ]( J1 v
if (iedom){* }; X& ] v, @$ z6 r3 Z; o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& _; }8 e, f* b5 i. S3 x& O
cross_marquee.style.left=marqueewidth+8 U7 X6 q7 H! d E2 w6 j
cross_marquee.innerHTML=marqueecontent
3 }- G1 \" a4 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* b+ o$ E- F" s0 T7 s% M4 \}8 @' E1 H4 L- j
else if (document.layers){
/ ~; `+ F/ ]: Z+ |ns_marquee=document.ns_marquee.document.ns_marquee2
' V- n( P; _; x; i+ ^+ `ns_marquee.left=marqueewidth+8
$ y3 w$ W0 V" }! jns_marquee.document.write(marqueecontent), D! k% E4 b Y3 I5 E, k8 z: W9 ?
ns_marquee.document.close(): K6 ?, J+ H( }/ a# }* i" o7 ~7 s
actualwidth=ns_marquee.document.width' g/ H( h z$ Y
}
/ _! r+ ^4 f6 U, n. r$ M, B+ ^lefttime=setInterval("scrollmarquee()",20)% f( M1 V% ?9 o* e2 T" _8 e
}
9 y( m) q$ f; _, jwindow.onload=populate
& d9 l0 y: d7 a8 ~% W9 I
- K/ F7 B# v8 K- ^/ y* g* tfunction scrollmarquee(){
1 N' q' E+ j1 _7 B0 B, {if (iedom){. G$ l; F& Q9 c0 \' d j& R5 z9 b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 y( J* K4 ]+ Y+ q, _2 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 x" N: D) G' B$ r/ Ielse
7 o) L9 L a) ^/ ?/ M9 Bcross_marquee.style.left=marqueewidth+8
) Z* \7 A( H; G$ A# Q
L/ R$ H. R7 K8 x& z3 i N5 W$ S1 b}
# S# `# [7 T; felse if (document.layers){
, ?- y" J/ y! z9 F) oif (ns_marquee.left>(actualwidth*(-1)+8))4 R* W! w1 m4 B. m
ns_marquee.left-=copyspeed% K3 J% ~3 [# G2 j, D( B7 j
else
' F1 T$ t; F% V- z: `& fns_marquee.left=marqueewidth+8
G1 Z8 H) Y. K} L. {; H- e1 U/ W' Z
}$ Q: h( C$ s$ z7 A; L) l9 x
9 b4 o( g) B4 n% B: y
if (iedom||document.layers){
' S/ W p* v6 G# e ?with (document){
1 y+ A- @2 K' l+ H: C; Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ Y, w' l N& V5 y# `if (iedom){
0 _( G% o. G/ [" rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- h3 G. u+ @* e( S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% C. C7 B6 G; D; I/ @, \- Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* }$ r- t# W3 L5 s
write('</div>')4 M6 f7 \' _0 v' V
}. B" j% Z |0 l& {. Q' @
else if (document.layers){
7 H( C/ s/ b3 n6 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 t) _5 p. |$ \4 p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ C0 Y3 ~0 @* S7 B) e4 _! D. ~write('</ilayer>')
2 v, B% I6 k, @0 x+ }}, S3 s4 h% U3 s% s. V5 I
document.write('</td></table>')
" d' y% O7 F, w" u: n# S}
( _+ K5 P. K! Q& ~1 D3 H9 g3 Z1 E}
+ X! Y4 M2 L. W9 [3 o</script> |
|