返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ l  ^: Y4 T' p, _4 _
var marqueewidth=300: W! j. Q# l5 P  k) |* c# R" q! Z
//高度
0 |5 O2 R# ~9 a3 I* P  q7 q! Jvar marqueeheight=25
" f) o( F! a, D; f# S' v# \//速度(1-10)
) F9 G$ s9 i3 _$ Z  p& ]0 zvar marqueespeed=32 @4 L; @$ a8 O( J
//背景颜色
  J  W6 h% h: f% |& jvar marqueebgcolor="#FFFFFF"
" u  t# [! c; @& l* n4 W//是否能暂停 (0=no. 1=yes)?2 o; z; c, \2 A# `( ]/ \
var pauseit=1
6 f4 d4 K$ W9 g0 {! p! A
. B' @4 t3 G0 R7 k5 W4 l- C//修改显示内容6 R/ p, j2 l9 `- b, I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 h- ^5 f( D" F. I$ [8 r! `
( C3 r  o, l) W& b& W' g0 q" |9 n. M7 W9 u6 A; i
////下面不需改变////////////
  ?. W! Z6 [' R6 f
5 R2 Z7 Q9 q+ ]  ?& o: \var copyspeed=marqueespeed$ r8 Z* k, W4 F2 m7 G( ?
var pausespeed=(pauseit==0)? copyspeed: 0! o5 Z! V* ?9 s! M/ _; [( A8 d
var iedom=document.all||document.getElementById+ Q8 h# u6 A0 H5 T9 C+ k, O' q
if (iedom)% a' |! v( L) }% S- ^, d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). X# E2 H2 o8 A; b9 o- H6 C
var actualwidth=''* `9 g) b& _/ ~  g9 K, m
var cross_marquee, ns_marquee7 V1 M' {, y# @9 _% e

! c9 u% ~, X8 N- lfunction populate(){- j6 C2 w! W7 ^4 L' Y! \3 Y
if (iedom){7 v% `4 C" A3 x, F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- b) S# b. E2 ^' ?& F
cross_marquee.style.left=marqueewidth+8/ ~; c6 s* p! I+ J6 V0 v" R9 r
cross_marquee.innerHTML=marqueecontent
8 t9 d7 w4 n7 T9 ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ W  e' @2 d# r& ?9 n" M/ @
}$ W5 e# y; j! L* y! ]: a  r8 ]4 {$ h
else if (document.layers){% {& ]4 i7 U2 H. Y6 l- k4 y$ u" L7 T
ns_marquee=document.ns_marquee.document.ns_marquee2* f4 q2 @* R  r/ g
ns_marquee.left=marqueewidth+8
5 e6 \3 d4 j/ Y, h* M- ans_marquee.document.write(marqueecontent)0 c) Z9 W7 G& N
ns_marquee.document.close()
3 O* J. @5 x. `, ?2 sactualwidth=ns_marquee.document.width9 y/ M8 y) x/ s& z& |8 X& w+ Y
}& b# s1 Q( `4 b2 w9 c) J- W
lefttime=setInterval("scrollmarquee()",20)8 v0 @8 l) Y) `$ f0 u" A
}
# w6 s1 N1 D1 }0 K3 W+ h7 cwindow.onload=populate9 c6 v/ v$ k3 O0 r7 n' J+ L
; T$ m) K0 ^* q
function scrollmarquee(){
- `( g5 r% }2 s4 I1 ]if (iedom){
  R# T# g6 L1 J0 d% ^- kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 Y( ^  `! n3 s! c8 W3 u) j" t/ |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( m- a9 k, I) L! _. o$ b! ~' nelse
1 W- C* O8 ~- d4 Gcross_marquee.style.left=marqueewidth+8% ~0 o& L, K& o7 r1 F

7 Z0 p  {  d% g- J& ~- {}8 o# ]  a! r" T+ U% B' j7 X+ B2 j
else if (document.layers){
, y* a1 K4 ]+ I: m. j6 Hif (ns_marquee.left>(actualwidth*(-1)+8))
6 m) J8 e' q; D  f. _ns_marquee.left-=copyspeed
4 B& ]. h# |, Ielse6 ?% U2 N8 c8 y5 x, j) a5 R
ns_marquee.left=marqueewidth+8
5 K( S# Q  I' b+ i9 |, I}
: k; l/ ~8 v" b- G8 p}
' L4 T+ ~3 K9 v
- A1 S, e- _- l; ~3 d. nif (iedom||document.layers){3 p# n; Q% a1 g& ^2 W0 z# J
with (document){% f7 v/ Z& [  B7 p/ s, T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 @1 q- E# a. A, c4 b7 o/ q
if (iedom){
" a) ]0 H" N7 V5 Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 K9 F9 s) \: V8 Z: f3 r- K) @" L' Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ O+ L& t- D5 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 o. j  j: g5 s! p- M! C7 Kwrite('</div>')1 U1 e& o' v: U9 r/ Z
}
' Q  k9 a! H& U. ]; z: ~: Qelse if (document.layers){
" k. u( X  O/ f% {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 K$ H, y* }! s8 f( w4 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) K' u! ~+ c" ]! Y5 l
write('</ilayer>')
& d. [% K! p7 K( F}- O. O- |4 k  L
document.write('</td></table>')
4 ~6 n% A2 F9 k$ e}
/ K+ `6 z4 y8 {+ I! e; J}" c7 ~3 K3 z+ q! h
</script>

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