返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 I( |3 u" h! U. q
var marqueewidth=3006 \3 Z9 i1 m* {$ g/ a% o# Z
//高度
+ T8 A  d! v, Ovar marqueeheight=25% A& Z9 R6 Q, a: s) w& G
//速度(1-10)
9 Z2 J$ o! {9 i$ w. d5 R) Xvar marqueespeed=3
; b. G( ?3 Z* z1 `; @9 p//背景颜色: I/ O% @# D- y9 w5 @1 Q# y
var marqueebgcolor="#FFFFFF"
* N3 u+ e) \1 U4 Q- Q/ d//是否能暂停 (0=no. 1=yes)?# s, ]) [8 c8 O* l
var pauseit=1
0 {/ Z5 t8 P! H* j. j
$ T; A3 b; i; U* \; P" b1 h0 x% J) q//修改显示内容: {% j; V( w* i( J7 V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 s6 H3 h) K- ]
" g& B: m1 D1 `: i/ i; q* T2 N9 ]
////下面不需改变////////////* g* L; S# v8 u3 b+ l! r

) W  T: W; ?% G# C  u- q  j, [var copyspeed=marqueespeed' D" W3 ]9 Y- c& v  H5 p
var pausespeed=(pauseit==0)? copyspeed: 0
3 B1 X4 ?( K+ P, ]& S5 i) K; H" lvar iedom=document.all||document.getElementById. m5 ]( ]+ _; r+ P/ F
if (iedom)
6 t! K5 b: H' ]4 Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 K" O  U6 D; x! t* T
var actualwidth=''
! m  B8 D, z' m1 n; o! E7 r4 X, _2 `var cross_marquee, ns_marquee
) ~% V7 f' ~) l; [( j( K7 H7 U+ o3 Y8 x' W! X+ I
function populate(){
  N5 T5 ^- e$ f7 ]' t6 Kif (iedom){
! U- o; A, `# U# @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- B  s5 o; \* D( R
cross_marquee.style.left=marqueewidth+84 F; x( C7 l/ f' L9 [
cross_marquee.innerHTML=marqueecontent
. G7 O! [1 _7 d: F& {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" W, {' P# K! i) W7 C
}3 _7 e: B. x; o1 |; X$ {
else if (document.layers){
9 ~; L- F/ T# [+ Q& [# k, Ons_marquee=document.ns_marquee.document.ns_marquee22 n! B) I2 [8 @0 Y' \6 O/ M8 t' d
ns_marquee.left=marqueewidth+8
2 X' A3 I/ S( vns_marquee.document.write(marqueecontent)
& j3 u4 P1 E2 l7 M) Ons_marquee.document.close(). }& o- U: H% \1 T, C- U2 h* y, S2 i
actualwidth=ns_marquee.document.width
8 s4 w; o8 e6 ]6 z- A2 @}
9 u! K3 X" b" P- E, |. mlefttime=setInterval("scrollmarquee()",20)
! C" X/ M; K8 `" J" y+ [}' F. w6 Y: r3 s$ x- u
window.onload=populate. K5 t6 o2 x/ u  {% k

% Y' y8 G4 q, K4 h( Mfunction scrollmarquee(){& w9 s0 k1 R" F1 M( T7 u* {" K+ H0 X( G
if (iedom){0 p5 ~! F* c4 J; s2 m) `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ w& C4 w! V! A- E! {7 w; E7 B% H. C% D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 j. W3 m# y# C# R( W
else
% @+ W8 X5 L3 r" d2 ]9 O8 p! Ccross_marquee.style.left=marqueewidth+8  b% L' u5 w3 S& K  R; B
! x' X5 ~& m9 _# r6 s
}
  K6 e( W9 u  @" a6 g+ N# B6 Uelse if (document.layers){8 Z# z) i4 P4 y8 @7 J: N/ k- t
if (ns_marquee.left>(actualwidth*(-1)+8))2 O1 Y& S" k. k' u
ns_marquee.left-=copyspeed
7 F8 w: c: q1 [: Melse
8 O# D& z0 }5 a* E4 ]2 B& ^ns_marquee.left=marqueewidth+8% b2 R- \; |5 c6 k1 B
}
% R- Q! U9 `5 m}( f& ]2 K; C2 e; C( ?- ^! m4 k

9 z& l7 e) \8 ]if (iedom||document.layers){2 a+ ^" ~" W' t- g( l8 f
with (document){2 x/ E3 J, s! z; s/ H9 n6 j- q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 f7 h: @1 W& D# U8 U% |: w
if (iedom){
- r5 ]0 ~9 y6 E% q& Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- B7 B, J: W3 W# @$ R0 R: [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ b7 l: {- ?. m5 [! T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! |, G; ^4 z& K9 Y( f/ \
write('</div>')
5 [  C* d0 d) K$ C}% D3 y% w( |8 {2 q8 x! I" e
else if (document.layers){/ t* U* s9 i3 i7 V- H# \6 u  p: p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 K4 V- m/ ^% @6 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" Z# ^5 r: B' R2 d+ K
write('</ilayer>')% |$ F$ _- S' y8 I2 D
}8 {5 [6 D" u/ c# D
document.write('</td></table>')
8 t8 w6 o* x4 h}* h: f, q; r+ a4 W+ x
}2 ?: m& e) m/ ?0 y5 B
</script>

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