返回列表 发帖

网页之跑马灯文字特效

//修改宽度# {/ u, u' c. o# L7 b1 H% i
var marqueewidth=300
4 ~& O' t8 A6 Z" D# z3 g2 o% y//高度# {# ?0 y% g4 S4 }6 }2 e* Q. z
var marqueeheight=254 q9 @8 p- @; a
//速度(1-10)7 ^1 ^$ A& D& J
var marqueespeed=3
* H2 F8 R: g3 ~2 Y1 c, d# `1 J//背景颜色
, ]$ D' K4 ^3 {var marqueebgcolor="#FFFFFF"
. K( ^. o1 D, u. r% ^//是否能暂停 (0=no. 1=yes)?
: [& D0 f7 b) Q. |  k) m2 |var pauseit=1
, v% y0 G: ^$ u
. H5 @2 t$ @  H//修改显示内容
) {6 O/ o" W& X1 H6 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% j" E% \" A2 N1 w8 c2 f
0 x7 J) }2 a5 e  M" ~: _
: D( m6 i, X- U# K
////下面不需改变////////////
# m. n+ B9 S1 S/ v4 o) a
  d3 W" M' f+ }3 d7 `var copyspeed=marqueespeed
$ \+ \; \4 T- S8 Z" {1 U( J% U' zvar pausespeed=(pauseit==0)? copyspeed: 0
! D% v/ P; K% E8 I, evar iedom=document.all||document.getElementById
  R% L9 E$ L( Lif (iedom)
2 U$ y- E; s1 W  e4 Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 |3 r/ Q$ m( ^var actualwidth=''4 ~: C2 h. O8 O0 W/ r( u
var cross_marquee, ns_marquee6 t9 ?2 S, ~0 a" u2 Y% X) b3 {

' a# d( x! Z, W' h* R: |/ Ufunction populate(){0 g6 C: m# H# u( i# e
if (iedom){
- ^3 \: e, n$ I9 T) z: Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  V9 @/ F" i( ^" K8 N$ ~cross_marquee.style.left=marqueewidth+8
; P/ j- d& h5 s. w3 r" Dcross_marquee.innerHTML=marqueecontent/ W2 ?# h6 j! C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; A1 f" q$ d( y: i* {7 q}, U" S1 b+ _: e8 o8 H
else if (document.layers){7 m2 `1 w8 N# g# C' Q$ f
ns_marquee=document.ns_marquee.document.ns_marquee2
0 V: F. p. N& c, w8 ?+ k: x% ans_marquee.left=marqueewidth+8
: l% E: A$ h7 I! {5 Wns_marquee.document.write(marqueecontent)
) p) ?0 n. ^7 R; {# O3 n; Kns_marquee.document.close()
, ]& A) |9 L9 t) G, Gactualwidth=ns_marquee.document.width$ F% ]$ x+ r3 F% I# _9 e% Q+ g& D
}0 O0 x* L9 F3 @6 A
lefttime=setInterval("scrollmarquee()",20)
- x! t; a: R2 R}
! q( [- k8 i* ]; w# c1 T5 Bwindow.onload=populate1 z# O# W! I% u' H
" B' w  }3 g# H" X: `- `
function scrollmarquee(){
, q2 A& I1 u  b+ c" Tif (iedom){" \! K5 W/ K( ~6 i8 L; `3 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# f1 {7 c1 v& ^: J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& l) K" U1 D. F% Y# \$ o7 r0 Ielse' S  S" R! U: [  n
cross_marquee.style.left=marqueewidth+8
3 c; X0 U3 p5 i$ i2 V+ `6 _
; w1 P' E- w" ~" l* e8 ^1 B2 |9 L}8 J  Y& F  f' c; |3 [1 Y
else if (document.layers){
. x/ \' V! h1 `0 Dif (ns_marquee.left>(actualwidth*(-1)+8))
( r, B# `% \: A9 p; B. ans_marquee.left-=copyspeed
. _$ M' I: F3 e) [: \9 melse
1 P1 |& G, R4 s5 K% Gns_marquee.left=marqueewidth+8
' S2 R0 M- I- S8 a% U5 z}
, g  b# J0 c8 F# ~/ t4 ?2 V}
- }. [% Q/ M& \- B  j
) L) _, l6 ?' j( g$ j7 ^6 ]if (iedom||document.layers){4 u4 ?- y0 t7 w0 m& V$ b: e
with (document){
. r7 E% ]$ }$ S" kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 s# u' a+ G! J8 `" iif (iedom){
3 O3 E/ E2 C! U( p1 x6 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; m7 F4 ?- Q' g; J- j7 b  b9 [# _9 hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ^: e& T" G! `' x, {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% \: f. S! [3 y2 \7 v
write('</div>')) c' G% E% _# v9 ]: g" }7 d* E1 w8 ^
}
' o. T- b, B6 ~9 f; Belse if (document.layers){3 J! {) H* Q3 f2 F: u* m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' g% ^  M. h0 w$ Z  q3 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" l) q- v  H' M: gwrite('</ilayer>')
' \  f) G# b2 e* q) M1 Z# ^}
. M5 \( K, r6 g2 cdocument.write('</td></table>'): I) b) E& k% }- J4 f5 ~
}
; o' a- R* w: F& x5 A}
8 }4 u+ g, g' W" g</script>

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