返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 r; f! B0 P5 A6 G
var marqueewidth=3007 V) {. \( S) P
//高度
$ r- `: d/ z- G* r/ \var marqueeheight=25
" E5 }0 P+ }" d* K, U//速度(1-10)6 \* j8 w8 f& K( A9 Y: c
var marqueespeed=3: {+ k, L7 b3 g$ E
//背景颜色
0 {4 H6 b& Y! i8 Z# {var marqueebgcolor="#FFFFFF"  B/ ~9 Q1 u# ^6 ~. `. K3 c
//是否能暂停 (0=no. 1=yes)?/ ?& D9 e  L, b4 z9 Z
var pauseit=1
  K; y0 {9 U& X, z/ c. V4 Z, b/ r" m( v! g0 [8 f" e# }; @' q
//修改显示内容6 r$ d6 }* y" ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. r7 T, k6 ~" o0 }
4 n8 ^0 {/ d% y5 n, [6 a0 L
2 D6 t  ]) y! G6 X$ B" P; `. c9 B" d
////下面不需改变////////////- i, _3 t, |2 \

; ~- w- W* {* O( _% _var copyspeed=marqueespeed& M7 y4 \5 f0 [4 m. X
var pausespeed=(pauseit==0)? copyspeed: 0
5 o' c4 ^* E; K( l7 f0 Mvar iedom=document.all||document.getElementById* l# e9 {' Z' ~: z$ L* x$ Y
if (iedom)
# H' y; s/ F" @0 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' I+ L; J1 b. {# o: V; C, l9 L+ D
var actualwidth=''( V0 Y! g8 D4 i0 E8 R
var cross_marquee, ns_marquee2 v: `5 g1 o& a  H& x) ?

" [, c& p. s. ]$ _) z# afunction populate(){
3 n8 @9 g  Q' l" |  e  Dif (iedom){9 `# J$ g! a9 e7 p3 O% y; h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 `  x# v% m: \5 {5 @, q
cross_marquee.style.left=marqueewidth+8
# @6 y0 y: N* [4 n7 W: ^/ ?cross_marquee.innerHTML=marqueecontent# v" A/ L9 j: M! s% B* Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. o# W( q/ h8 N! ]: N5 r1 Z2 L
}+ C& Q. Q& M5 |2 K' L
else if (document.layers){
' S/ P6 M% V! O) p! q* X( qns_marquee=document.ns_marquee.document.ns_marquee2
5 ]" L: h& Y) \# R- \6 a" q: {ns_marquee.left=marqueewidth+8! Q; P& i3 ^& v# ~5 `7 J
ns_marquee.document.write(marqueecontent)' H: W* ^2 U5 b6 z0 J
ns_marquee.document.close()4 t, D( m7 x4 v5 m9 t' ~- C" h$ L
actualwidth=ns_marquee.document.width
0 q% B  o8 P% S0 J! y}& b+ F7 Y5 ]  R. X& E
lefttime=setInterval("scrollmarquee()",20)* l) ~9 h  c( W5 J" K+ L, t" Y
}6 b+ [# e* i$ Y8 w
window.onload=populate
8 i2 A% Z: H: X4 G# a; V6 r9 {& M6 R7 u6 v! `+ s9 O) e
function scrollmarquee(){
; y5 K5 h) h, @& b: x3 R7 o: Mif (iedom){2 |5 F9 G# [. }* M" G: n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) O( j/ H) U1 w# C$ a; jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' ~' C9 y" K; V3 J9 I& _# p
else3 l' N/ `/ `* {
cross_marquee.style.left=marqueewidth+8' }' V" ^) p. ?; G
6 i+ R' z+ b  Z' z! c; X, E+ [
}
  \- ]; i0 j0 ~6 C! Yelse if (document.layers){; X4 c* c. i, N; b5 T6 r
if (ns_marquee.left>(actualwidth*(-1)+8))6 f/ }( j' `1 N3 O" I
ns_marquee.left-=copyspeed$ t; r8 }) _4 X
else
5 p" v/ ^6 l2 l7 rns_marquee.left=marqueewidth+8
5 z' h5 J$ V' K5 o4 @) o}+ G+ O  R8 N5 p9 W9 ^( `, O3 t0 O
}# V2 P1 ]. l: h# T0 O; N2 |

( f; B% J$ Q0 x# l+ i) bif (iedom||document.layers){3 l% D; ?$ G, ~* ]# g
with (document){
8 u! g) s6 b5 o, \# E" ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 n9 C- [& T9 t- x# Fif (iedom){
6 t& Q- p. h  nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 p$ s* _1 M; W3 Z- N5 Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' d6 j& _, B6 G* ~" a( X, H- q+ t6 [" ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ h8 G( q; I. k" e1 \4 B% b. }
write('</div>')
% \9 {* _. D9 t9 g}
$ z# k* b" ?+ a: Y7 {else if (document.layers){
; X6 W* {6 o& mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' F' B0 x7 x, s1 i: C) w) U4 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" A& h, c5 l% o( ^7 q+ ~write('</ilayer>')/ K1 f& ^+ p3 k# t
}
9 w1 }- m: u" e' S" C% hdocument.write('</td></table>')
( r; `$ v# o' }}! H& m" K1 b7 X* X3 E" v0 a# x
}/ e: k4 X4 G% }/ j
</script>

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