返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' x9 l6 ~9 s4 q6 c- H# V/ [  f% G1 H$ A9 ~var marqueewidth=300
9 a( Q. [' g; T2 p5 r& p+ f' I//高度
9 d& \& Y: u+ f8 O/ M. V! Uvar marqueeheight=253 N) S$ l+ k- ?# f, M1 Z9 b+ J
//速度(1-10)
- q6 t4 C3 P( f6 qvar marqueespeed=35 l/ j4 u- x) u: N0 X. R$ D8 z
//背景颜色
" g: B& e) L& Z5 N* Fvar marqueebgcolor="#FFFFFF"/ I" a: h. Z1 ?! d
//是否能暂停 (0=no. 1=yes)?
, u+ p0 y6 W, B1 T* d4 Jvar pauseit=1
2 U9 c: O/ k9 F/ ^8 ~$ A
7 ?! c; }, i% Z" }//修改显示内容2 N' Y  Q( x* o+ y1 u. j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  n+ `- a* Z$ n7 o3 w2 |+ u# N8 t9 f9 r- |9 m

, m4 V8 _& I4 Z////下面不需改变////////////4 n9 B: e) P8 w1 S" h/ X8 v
1 \3 F6 K" M  J
var copyspeed=marqueespeed: y! @0 ?3 W2 |! a4 P2 U8 b
var pausespeed=(pauseit==0)? copyspeed: 09 M+ |# p7 U& K7 o
var iedom=document.all||document.getElementById* X; T% }9 I) \! k  f+ b6 i/ b
if (iedom)
: O- Z6 p) V" _- O/ }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! ]1 P" W# v+ i1 c$ E8 A! O
var actualwidth=''
( B7 |5 I1 `+ q2 r* {* D( E8 Avar cross_marquee, ns_marquee  X- R: n7 R6 h, O
. q/ V9 p+ [5 ^3 |6 l
function populate(){; I, a3 S/ L) u$ V1 `" o2 X" d  y% ~  n
if (iedom){' f( T! h' b5 E6 t! B# T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, u( {; A/ L, n0 r2 Ocross_marquee.style.left=marqueewidth+8
- D$ _  _+ B2 [: ~% o6 m1 @cross_marquee.innerHTML=marqueecontent
; S& O+ O' O$ _" Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. j( [- q5 G7 v/ t4 U- g0 Z
}& S" h4 Z) v/ ^
else if (document.layers){
. T) C0 ?) |3 h" K; \ns_marquee=document.ns_marquee.document.ns_marquee2* u( n; v7 F; U; `- c% ~/ c! m
ns_marquee.left=marqueewidth+8( a7 ~- k# S& Y
ns_marquee.document.write(marqueecontent)0 `* g8 t# x; x2 Y, }# ^: ^3 |
ns_marquee.document.close()) @( y" J) n1 b: ^
actualwidth=ns_marquee.document.width
8 t/ j8 i* S; Q# b6 k3 Q0 u: x}  k4 O# a" {& A* \# y: {  {0 B
lefttime=setInterval("scrollmarquee()",20)8 k1 q& ^, ]' x5 t# F0 f
}7 W# o3 L) O, m% |' O$ `
window.onload=populate# l3 v& q; t, k' a9 d

: @3 P+ R3 t  X5 [7 i! dfunction scrollmarquee(){. {' e# C0 w5 C. x7 E2 ~. `- l
if (iedom){% t: t9 G* C3 R0 @3 U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ e4 V$ S2 P# R( x8 t: J3 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. F! [% E' C* j
else! I, A$ X$ g: E2 d# `
cross_marquee.style.left=marqueewidth+8* h( o  ^; }  n) N; x
/ l: h. c, ]- y2 l8 m, M0 \7 C
}5 Q. W" R4 P% w( [6 |6 Y- K, M
else if (document.layers){; F6 g  q  U/ O; ^8 `" ?
if (ns_marquee.left>(actualwidth*(-1)+8))
" m. C3 a8 K! y# Sns_marquee.left-=copyspeed
; A2 F) U% J, G) K) \& p6 g# Celse
2 e) H9 q$ G! a! k3 t5 }2 S3 s8 @ns_marquee.left=marqueewidth+8
* V2 V8 g$ M/ s1 G: T: S}
  |1 n/ V. i  Y  ~; g: ^}- F2 u7 {( y4 _) F; k
, d+ \4 G5 ?. o5 n% E8 p+ k
if (iedom||document.layers){% k4 [2 \) H, C" j, h
with (document){
! K! @; U# U; ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) r) c% p. Y2 C5 C* L/ \4 i
if (iedom){
" a# s6 P. d" K- Y' j7 w2 g1 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ E/ s/ z- `4 F% q5 x3 s2 C' Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; w) A6 H; |, J8 _7 W1 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ K* Y% g" O( n, ?( E6 Kwrite('</div>')6 o( c! ?: Z. m4 ?1 W2 k
}
& z' A  v5 H( Q* v( i" C8 Ielse if (document.layers){
1 \9 c! j7 C* R- t( \2 u* Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 v* S7 `; A; t! T  j3 @2 o: awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" H; }. d, |5 \7 u
write('</ilayer>')
* S, U0 K- _  [. h2 j/ Y3 b% m! Z$ j}
  e( W6 h4 t4 N* }$ F3 Q7 Qdocument.write('</td></table>'): w4 s2 K# X% w1 Q/ e0 _; Q' N- T+ I
}8 u/ @( ]0 Q; U! H4 `
}' I* c  J% a7 V' ]6 m: h5 e4 y4 g
</script>

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