返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ C' d+ C" t- Q3 _var marqueewidth=300
) x( M4 H+ C4 o! r0 p- w8 R5 Y3 k//高度3 w; W2 e' B  K% D; d$ E' o
var marqueeheight=25
+ o+ @  d2 E! h+ Z4 _//速度(1-10)+ n3 r5 i9 n5 v
var marqueespeed=32 T3 |/ w" P5 z$ \( [) A
//背景颜色9 \9 K8 y3 S* o6 b( K! I; ]3 _4 y
var marqueebgcolor="#FFFFFF"
- t7 Z9 h( R- y" B# t: D2 E//是否能暂停 (0=no. 1=yes)?
2 j, V( o5 ^3 k/ ^0 x' q3 `var pauseit=11 D8 F, N5 z6 }& f6 K
; `! b5 y% U5 e; u- A
//修改显示内容% Q) n: ]7 L) Y6 O0 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. O$ o& T4 O9 P/ I0 q. R
+ Y0 x! {, o8 }7 A# C# Q. K
9 L5 w! W8 S3 A4 U' B8 U////下面不需改变////////////9 C# v* W! `+ C: @) y5 w6 n

* i; ?5 A- y' i3 lvar copyspeed=marqueespeed$ S, }/ e! |7 k/ ]4 y
var pausespeed=(pauseit==0)? copyspeed: 0
% ^$ i6 a1 @# J+ b: f1 |; Z& Dvar iedom=document.all||document.getElementById
( U* ^) Y2 n( \2 h6 s& Yif (iedom)
, r5 z. q9 U- y& X8 M" vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 [) ]/ A" F3 _: ^& mvar actualwidth=''
4 p& G) U" m' I. f" tvar cross_marquee, ns_marquee2 j% H% D6 w$ K" q

3 C  O* E8 o. O8 m' m. @9 y- m9 [function populate(){5 N* }3 C. V, B& }  z3 w8 n: U
if (iedom){
5 `; b, \0 ]/ p# w" X6 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 R! Y3 L* k  O9 C# x0 rcross_marquee.style.left=marqueewidth+8
3 ]0 v3 o- E1 R: g0 ^# F3 Ycross_marquee.innerHTML=marqueecontent
/ d' e! `' `4 G* M! dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 Y! [- ~$ I2 W5 I/ p3 B1 j( H
}$ J5 f, {7 z% S0 }& M8 y7 ]
else if (document.layers){
7 a/ X3 ^( l" x; y2 E9 mns_marquee=document.ns_marquee.document.ns_marquee2$ ?3 z5 b; P. R  f7 s/ _% W
ns_marquee.left=marqueewidth+84 g, n0 \* P9 r9 x
ns_marquee.document.write(marqueecontent)
. j0 |6 U7 p$ f3 c, ~ns_marquee.document.close()
9 r: s$ R% K" k1 k7 d7 r$ kactualwidth=ns_marquee.document.width8 b0 m( {7 K$ l  {+ \/ j# L9 c
}
! |! f! `7 l8 M4 ^; c! n' _lefttime=setInterval("scrollmarquee()",20)& w4 s0 q# D, N; O, A
}/ P% T+ P/ U1 I
window.onload=populate
  E1 r# `! M+ `! A0 R5 y, m4 M2 j* e7 j- h% k
function scrollmarquee(){3 ^2 R/ S# o3 H2 m; P" p0 ]" l) n
if (iedom){9 f( b, x7 l" Y/ u4 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* }# y1 [, f7 H7 P" F; X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# [: Z# a' ?( m* g
else' Z9 v9 a* W/ W8 y! s$ }
cross_marquee.style.left=marqueewidth+8
. b8 l0 r% K& i- `% {( A+ F
! S8 v! \3 S: y1 z* s: z}
8 p. X0 k% @! M5 T0 V5 ]else if (document.layers){; x) ?4 c$ j0 X; R+ p6 U* l
if (ns_marquee.left>(actualwidth*(-1)+8))
: j2 V; j; K% h* H. Ins_marquee.left-=copyspeed$ c$ Y7 H0 v. l$ {, u
else
2 t, l. {: ~4 Hns_marquee.left=marqueewidth+8
5 b, }1 w7 p7 @: [) @8 P( p5 v5 F}4 p, K  m+ _! Y! b! L9 J' d
}
6 e$ r6 d. ]  b) X' i$ S5 N0 A. }
, Z/ J$ V- l' A. B8 h  r( y" Eif (iedom||document.layers){
8 o! \9 U' `: R$ Y4 `with (document){1 }# H) R' ~( _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) h/ P' T: z" I  jif (iedom){. ]& l3 r5 L7 h6 W; y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 X# Y$ o! K4 M5 C+ L" y( p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" w1 o; |3 E1 Z! V! d& cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ \7 C7 c8 M3 J( z) I/ L
write('</div>')
+ e0 b' a5 \: @}
" Y% q2 y" ]$ J2 [; Yelse if (document.layers){( Y  t& }, [1 N9 E7 G1 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) C+ \# n* }# c$ xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# q! v% d" Y: x' Vwrite('</ilayer>')3 L. f/ @$ x. g9 ~4 \. h' E
}9 t, Z/ R4 i& \- B9 G
document.write('</td></table>')
; u& d0 A8 m3 L1 b+ I8 `0 C/ A}
" @* n2 p! X  b7 Q# P- ]}
/ S" \% u1 p' k</script>

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