返回列表 发帖

网页之跑马灯文字特效

//修改宽度, L( p, Q+ N7 b) S7 `
var marqueewidth=300! n4 R& L. R% U0 a6 X
//高度
3 P8 y- D* F6 f, B8 nvar marqueeheight=25
8 `& V, T2 j- Q! \3 }+ u//速度(1-10)( r6 x% `8 V' S% o! o- g: }- ^
var marqueespeed=34 C  L  ]7 f9 K( ?
//背景颜色
! }; P2 {) ?8 p( l6 cvar marqueebgcolor="#FFFFFF"" g+ c4 C9 Y0 u: O# \# V# a, J+ w
//是否能暂停 (0=no. 1=yes)?
% M' h& o1 ~6 J' Kvar pauseit=1, {. U! L7 r6 \+ W2 D

8 Q6 n* X/ b% k+ C, I: z//修改显示内容
2 v. T) I# [' ]: Q- s- Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 W0 m5 X' Z& `6 a( N+ O
- x. |- v- Y: n( h9 Z5 N  j9 K2 {' u7 A- h5 a1 q
////下面不需改变////////////
7 m9 a8 H1 C, C, `4 E/ y% _9 w/ D
! @2 V0 a( F- P" o) X  a& i8 avar copyspeed=marqueespeed: H" Q3 `4 @0 R2 b  y
var pausespeed=(pauseit==0)? copyspeed: 0. F7 i7 z8 C+ [/ z! {! C  c. I
var iedom=document.all||document.getElementById
* g8 F2 ~8 Y6 ]: w4 |6 [if (iedom)6 D; @2 k4 ?3 v2 i  n3 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 F% I0 f5 H, U$ g2 D0 n, Pvar actualwidth=''
. a* T, U. B6 l& T1 {, rvar cross_marquee, ns_marquee
, [8 r# @/ H+ r" m6 t- U/ b
  T( h# a6 X# W8 g2 F! yfunction populate(){* ]+ o5 X$ f& {
if (iedom){
# E7 x  t5 i, L7 U$ _/ bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ {3 H! e0 }& u$ q8 l
cross_marquee.style.left=marqueewidth+8
" y! E7 |4 g" fcross_marquee.innerHTML=marqueecontent
" @7 z' O* B$ X% C6 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" F+ Z4 |1 j) Z. u. T; U( S9 V}1 L0 L% n+ g1 `  K5 ^. a6 t
else if (document.layers){
1 d6 p3 S, P4 t. S; T( m' z( _ns_marquee=document.ns_marquee.document.ns_marquee2. H) k9 l! P# `- a1 a" \
ns_marquee.left=marqueewidth+87 d# A) A, d9 l/ D3 ~) u  ]
ns_marquee.document.write(marqueecontent)
. i& V9 y" W' w' v2 ^9 {ns_marquee.document.close()
& F: V; G1 ]' H( j, E. oactualwidth=ns_marquee.document.width
+ Q3 o7 J" {/ G7 w) ?. K, f}  b: z4 y1 d6 p# I4 a
lefttime=setInterval("scrollmarquee()",20)4 p$ f( ]1 Y' e1 Y% J8 U. o% X
}
7 @2 W* e+ U5 h4 e+ ?, e  Dwindow.onload=populate; H9 k- U# y; t
1 U4 r$ N$ Y/ c/ {3 N! [1 a
function scrollmarquee(){- e+ o: \1 r( {
if (iedom){9 w$ s( T7 [; M. C# i* N3 B; p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 W: {# o$ |3 z5 R) tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" _$ T7 s1 H* P2 N$ E
else
! C% N9 i* N" jcross_marquee.style.left=marqueewidth+8
4 t  W! o( I" F% f* A- B$ B
, F% S$ r  m3 B/ K: L3 `5 X9 a}" p! H  p" u" |. V* E& y- {, @
else if (document.layers){
0 W& w7 Y, \2 j5 a2 ]if (ns_marquee.left>(actualwidth*(-1)+8))5 p- H: R7 q$ }# z1 _3 [! g" A( T
ns_marquee.left-=copyspeed
% }( Y+ B! w5 uelse3 b% J. t" x: I8 C3 V
ns_marquee.left=marqueewidth+8
1 a0 _: S# E/ z2 x}
" `0 \4 ]! E2 Q* k9 y  {9 ?}
( ?; `$ `8 [4 B$ }/ i4 W! k0 t, V( G- O; s: X1 k
if (iedom||document.layers){. Y+ o; K( |3 F) _" O! n
with (document){
, I! O: X/ n( q2 h& Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! @% b5 z2 k' z! o& q. p% [if (iedom){
/ T$ O, B2 V4 B" ~$ d& z+ I. F( [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. [$ {, g: E% l; l4 @* Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! n2 V' y" l$ C, c( W! x0 ]$ awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 n+ D, A9 v- O. R  [
write('</div>')
  `- k# H. l1 i$ ?}
1 h$ U6 [3 h, k! ]else if (document.layers){
- l. D$ h5 S7 b- ?% Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  N. B7 k& c" O: q. J& T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' Z# }% c/ w; w+ P2 q* wwrite('</ilayer>')3 u+ r& o+ x4 Y
}' k8 H; x4 R! B% u7 n/ i
document.write('</td></table>')
5 w+ |" b/ i; K4 w}
2 c% @& E. {0 G/ m}3 X: ~8 u( K, ^7 `5 a& F
</script>

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