返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, Q8 \; L& G0 s$ D: Z! i6 @var marqueewidth=3002 k' v2 U; ~: _9 k* ?
//高度0 W! @3 Q5 f7 q. O5 v
var marqueeheight=25/ g4 l# c. s8 l/ {9 R
//速度(1-10)
/ p9 `; {% a( s; _! hvar marqueespeed=31 O# W, u. E( y( W+ Y
//背景颜色5 d5 t4 d0 q( @# v
var marqueebgcolor="#FFFFFF": [6 L. E/ r) K8 Y3 h
//是否能暂停 (0=no. 1=yes)?/ d! R. w  E! Z% X! D
var pauseit=1& v. L# x/ C" `( a* G+ x4 C, K

0 \& G* T- V& @! N6 {0 E//修改显示内容
/ Y( a2 \2 c) q) Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) I4 k  Y; ?$ r* P2 `# F; H2 t
  O; ?$ K1 V% o$ K/ u
1 Y# a+ R5 {1 w; L) W5 {////下面不需改变////////////: D( m( U" Y& B) U6 ]9 x% L$ h. s
5 a1 ^% a& L- o4 G# }
var copyspeed=marqueespeed
8 X$ F1 `# v+ \; {var pausespeed=(pauseit==0)? copyspeed: 0
& S# y' J5 ~7 J. Q: r' Vvar iedom=document.all||document.getElementById
! K! ?- r8 e. o2 }5 E  R/ `, @if (iedom)1 N) S% A$ @4 q- o$ m  r" w0 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( c; {0 n/ {. [. Jvar actualwidth=''
" {, E1 R% ]6 S( {" V$ |var cross_marquee, ns_marquee
* k  n/ @) N: [9 P. S* z& O) z! p; J
function populate(){
% g5 K# d% W' R! ~* p6 Iif (iedom){
$ Y$ q1 W! S, C% hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! Q0 y. i4 f  X6 P
cross_marquee.style.left=marqueewidth+8
" q( s/ Z" r) w3 A0 }+ lcross_marquee.innerHTML=marqueecontent
3 Q9 W1 `" A4 Z! x; G8 |% H8 wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  Y) A) s# M' A/ F
}
( u0 C; w5 g& g. @else if (document.layers){9 G1 f# Z4 a0 f0 G$ l  |$ e
ns_marquee=document.ns_marquee.document.ns_marquee2
3 {  W, T/ x* e9 Z( Qns_marquee.left=marqueewidth+8/ A2 Q! y& {7 g( s3 \
ns_marquee.document.write(marqueecontent)
; k* N: n7 x' |3 S4 B, o9 k, @* C. Bns_marquee.document.close()
0 i  ?/ W; _# n4 L0 p* A/ Cactualwidth=ns_marquee.document.width
- ^  R  K) L7 |3 h& a  @0 n  }9 i}/ o7 r" \9 o" W
lefttime=setInterval("scrollmarquee()",20)4 B, `; d! B3 V7 U9 \
}. j1 O' k' \; x; ?- I9 O7 {
window.onload=populate4 ]$ Y6 w- n+ S5 h0 g: y- ~$ |

7 a6 o. _, c' M! X" o% r' Nfunction scrollmarquee(){
: O7 T, s+ z' o& a+ [if (iedom){6 U+ k# ?7 F1 x/ C! t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& w7 n- J8 E; ~3 F5 S. B& @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! d9 [2 A% h, r) E3 ^1 |# belse
6 s+ N5 B# [# c1 q' A$ a3 Qcross_marquee.style.left=marqueewidth+8
, M- Y2 ^* D' i3 x( K1 ~* Y, r9 x' B3 j  k* K( D
}$ Y( h) H5 h# J9 s7 H7 u
else if (document.layers){
, H  n# `7 H( Y" `! cif (ns_marquee.left>(actualwidth*(-1)+8))
5 [2 f  y+ q) X. Jns_marquee.left-=copyspeed
2 u; ^4 i9 b& \$ v9 }else& K0 S' v8 X& I, H! `% F
ns_marquee.left=marqueewidth+8
* _+ a% j3 y7 N4 G( J* K/ v8 f}
7 K) |4 @7 J. e}0 X5 }. z8 ]8 T( J
8 d/ F* }! `/ a) F/ Y5 e, ]" H% p
if (iedom||document.layers){
( E4 s& f- F. [. I/ C) a  Zwith (document){
; q% [2 a  H7 [0 P0 z  M2 ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 B: Z2 c1 l# U" u, V& @
if (iedom){0 I- ]" O, R7 R6 [8 Z" V% |9 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 \+ |9 u7 Y- ^6 W" K9 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! b  {& Q, n& U( O* P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! K$ k& A; ~9 @, }2 }
write('</div>')
# E0 o7 e( v( t7 F7 r}
3 R- a" y+ u7 e0 selse if (document.layers){
+ T  M) \! T* D" J. J" Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ h& T( }* ^. awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  t$ D3 f4 |, G8 X
write('</ilayer>')
7 k* w, }1 h' O* Q' ]0 {}
$ [, B) V; ]; t9 T% t* Tdocument.write('</td></table>')! i  E% N% |# u. Z8 _: e6 b6 V
}
# p/ ^5 C9 C$ F& e3 i}
9 x4 m4 G" P# _* j6 H2 _</script>

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