返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) u  T' {$ v3 J. N. d! wvar marqueewidth=300
5 ~! P( o# S4 D; _//高度+ r0 z- @$ j! z; ?; f( Q$ \; c
var marqueeheight=259 S( t. i- F1 w$ s
//速度(1-10)
* [; |3 l# F3 F! b  N8 c, G4 kvar marqueespeed=3
( ^) a4 D. n* S% ^: |//背景颜色+ O, H6 J) }1 K# l4 z: f
var marqueebgcolor="#FFFFFF". @: g! I: K$ Q  z
//是否能暂停 (0=no. 1=yes)?
# K( R( o0 F" `var pauseit=1# @5 Q0 r! e$ r: b7 ^

$ k" ?! j" Q' r, Y/ G  q  P//修改显示内容
4 _) r+ r, x( C1 `9 J- {* F( j1 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 x( D) p2 X3 l6 }. j+ g* j* ]! j' o
- [  ?! Y  n( X# w) V, z
////下面不需改变////////////* h5 P8 Y* J* M2 i& c  v6 d
9 G) q$ H9 K: r& t
var copyspeed=marqueespeed
5 f% J3 n+ @6 ~( Yvar pausespeed=(pauseit==0)? copyspeed: 0$ O3 G  h3 }: B4 P& n- k! q, X
var iedom=document.all||document.getElementById2 U& M) \: j& F+ z3 k
if (iedom)+ V" _, s) ^# g& c0 [+ P/ V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 `/ @+ d. B8 |0 Z7 x0 U( Z5 E* o' ?; Wvar actualwidth=''
: }) c$ h8 H; d/ _3 zvar cross_marquee, ns_marquee! o% ^5 K- w. N2 W; p$ ]
# G! h' _9 T4 c: W5 _- H7 E
function populate(){& @# z  t# C5 l" j+ G
if (iedom){* i, S  F. z% |. k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' d+ Y' D% b! C& m7 {
cross_marquee.style.left=marqueewidth+8
$ o: W6 m2 P3 b4 y! P# Fcross_marquee.innerHTML=marqueecontent
* Y6 w! r+ @* Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ R# P3 J( ~0 V
}
8 ~+ L+ p- F4 q! G- j, k# Zelse if (document.layers){1 s: f! V4 `9 ]' P3 h8 s  w
ns_marquee=document.ns_marquee.document.ns_marquee27 ?* J7 O4 H0 U* z# F: s: l# v$ R
ns_marquee.left=marqueewidth+8
' x7 I6 [! J8 dns_marquee.document.write(marqueecontent)
. P6 J7 I$ t& j3 \ns_marquee.document.close()
% {8 g3 N4 U! Jactualwidth=ns_marquee.document.width
% S2 O/ L( k0 {. X; \/ \* _}
# n1 L: L9 x: a1 c9 X% `9 w7 Q, Dlefttime=setInterval("scrollmarquee()",20)& T# [. y3 J# u7 ^7 J3 P
}* L. s7 ?, T; D! n: f7 A- H4 @7 d
window.onload=populate
+ l- Q) n8 p. z0 h9 `) k
  m- `, c* i; n9 @$ Vfunction scrollmarquee(){
6 x0 N  L" L6 I1 O8 D8 H1 {if (iedom){
5 a5 `- C& Y# N- Z. I: f: _7 Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ Y- p/ t" ~& |1 p; q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! s" [2 {0 G/ H1 Eelse& f9 d/ g- c$ Z3 I1 E5 u
cross_marquee.style.left=marqueewidth+8
( y; h! J% a/ }" ?
, T8 M/ W1 H: c}
: E/ C8 ?7 H5 _& r& {0 celse if (document.layers){" D! @2 A) [; h- G0 z* T
if (ns_marquee.left>(actualwidth*(-1)+8))
6 m5 {" M# \$ m! B$ e4 ?ns_marquee.left-=copyspeed4 g' ?4 V3 E/ E4 u; ]& d9 Y
else
3 d' J3 d8 |6 m  cns_marquee.left=marqueewidth+86 l9 F2 f3 A3 i3 m
}5 i& |( p+ R$ [
}& J5 g7 L2 U4 ~- Y3 ^
! a3 [5 B& O' S# x; ~: f
if (iedom||document.layers){/ \! i. X1 f4 `$ e
with (document){/ W; q, L/ N6 ?7 B- E- K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' w0 z0 W8 A! p9 n; kif (iedom){" I7 f! W7 R  z! Q+ l! T2 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); d% x$ ~! l1 M7 I. Z7 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 e! F' b- b' w& D- |. K5 M9 m, m" W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ A9 N# ]' P  P# z5 Q3 {
write('</div>'): a0 ~; A/ N+ c  s1 G  v/ c5 p
}
3 s$ L, t2 l+ D- q/ Velse if (document.layers){
8 r! H$ G  J8 \3 X* v/ owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* P& W+ e% h$ n8 ]+ z3 g# i1 lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 [* g  m! v4 U) ^4 P  [
write('</ilayer>')
1 n- V8 l' |' R}
& Z. T1 V6 \8 U: a7 z  Rdocument.write('</td></table>')
# A% R7 ^2 x  M}
4 s! j$ F: E- L}7 p2 X- X2 U3 N& u- J* L: S* a8 y
</script>

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