返回列表 发帖

网页之跑马灯文字特效

//修改宽度- M* _$ L2 H6 l
var marqueewidth=300
7 b9 N7 x' I2 |; F& I  O4 N5 V//高度/ g# E, m( u! ]' c& P# d
var marqueeheight=25
9 k! U' s4 f/ \//速度(1-10)( v! H( R# K& ~* x: \9 e+ W& Q
var marqueespeed=3) K8 Q/ l4 e1 ^, Y9 N; w
//背景颜色
& B7 Z! ^' G" ]/ Q& `var marqueebgcolor="#FFFFFF"
* i; C! ~7 X2 A" K//是否能暂停 (0=no. 1=yes)?% C) s+ `' h9 p6 ?5 Z
var pauseit=1
& ^6 m6 e; Q8 w" J  k* ?, y; d7 P9 E' v
//修改显示内容
2 ^% e  _( f# @- P7 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 V+ h$ h3 }8 o' V3 Q1 R* `2 S
% v' e' p5 {/ u, N% W! I8 Q9 F
3 U+ L1 ?8 d0 h$ w9 \! F9 v' a
////下面不需改变////////////$ [5 m% {/ ]" ?1 x6 W, G8 ]7 c: d
* t, N, h6 ]6 [+ S# f) m
var copyspeed=marqueespeed
% d# f( ]0 k! \) O6 `, wvar pausespeed=(pauseit==0)? copyspeed: 0
- [$ R- @4 P2 C, G  q; v2 L0 Avar iedom=document.all||document.getElementById, A1 s/ Z# T( M0 \% @) L0 R. Y- c
if (iedom)' U! ]4 Q$ ?) b2 W% K  Z3 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  y* U+ N5 L: H9 K- K% K' Q% Z
var actualwidth=''2 y5 h8 J5 z! a
var cross_marquee, ns_marquee+ G" S. _/ Y' U  T# e
! W+ @; _' }0 k0 `" S
function populate(){
7 j$ x: G( E3 _" X& M4 ~if (iedom){- P) r5 p- P2 a+ R! {+ F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; ]4 |  L# C5 _cross_marquee.style.left=marqueewidth+8
3 _" Z. k7 u( {cross_marquee.innerHTML=marqueecontent7 H/ ^9 z0 X3 I8 J) g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 R9 l' x/ t) Q- y0 y  g}
% S* O' H# E' kelse if (document.layers){; B/ Q/ D0 o0 N; h7 E
ns_marquee=document.ns_marquee.document.ns_marquee2
2 f; S* \6 B. L0 rns_marquee.left=marqueewidth+87 i& @6 d: {* s6 L- N4 E7 T0 H$ a# f
ns_marquee.document.write(marqueecontent)
6 O2 @: p- D: A* ?, f) jns_marquee.document.close()
) w! q) Z0 y0 k* Oactualwidth=ns_marquee.document.width
9 B! I# V, l" @* @}; w' }3 x; r" N5 g6 B
lefttime=setInterval("scrollmarquee()",20)
" g4 F  Z+ _9 a}$ `0 g, y$ z. v2 J8 t
window.onload=populate8 L) O( a' }5 O* Z

9 Q: w+ S5 l3 ?# h7 o. W! [function scrollmarquee(){0 H% b5 f' o! R9 N- C1 P8 Z  O, ~
if (iedom){
3 f7 `7 e+ v3 e& _/ Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 s: O* O) ]% wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- ~& ?' m" w1 f3 Uelse$ m/ D5 Y! Z  r1 }
cross_marquee.style.left=marqueewidth+8" z1 J( c$ _3 {  w, e. {2 q$ C3 ^

; p; C, m" v5 }2 _8 m# l4 e2 ~8 [}
4 \( P2 \7 p+ h& V. ]$ B. @else if (document.layers){4 P$ B9 h2 ]* q8 t# O( o" E
if (ns_marquee.left>(actualwidth*(-1)+8))- n& v4 B" G; B. K  H. D
ns_marquee.left-=copyspeed- B/ D. k  }. q1 i& T0 e
else7 g$ y/ z. X3 S$ C' M7 U: J
ns_marquee.left=marqueewidth+8
. \/ z' {6 l6 t6 g  {}8 k8 o, I# [; s1 z' T
}& O1 O% ~. I$ L- }- C1 s- }
; j$ m8 h, n* w4 G9 J& q) \
if (iedom||document.layers){
2 U. ?7 ^; R; Q# F( awith (document){/ _2 d; M. o3 [3 D/ a+ B! q& _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 f" U+ B9 o: n; s6 O( W
if (iedom){
2 }+ j% C# {2 b3 `% E( k% ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- l3 U' _" V0 N6 e% [: qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% G  M, p$ I, o- S% e3 `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 t  g! T8 d7 o5 s( [write('</div>'); G* \5 B& F0 {; i# H% z/ s
}7 `" c3 D8 g/ N8 A8 P- W
else if (document.layers){, X. ?, j$ x/ Y) f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! [8 p; q0 W5 K$ U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  ?. W1 E( y& B: o) Q+ Z6 Z% u) Rwrite('</ilayer>')# M- P9 n5 }2 P
}0 v; I1 l; C+ a7 U( y* o
document.write('</td></table>')- |9 f$ p" _& i
}
5 z" k; {( H5 [3 B; m& m- Y) l% j& e}
0 d; _1 r$ J3 C3 X" o8 X0 M5 F</script>

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