返回列表 发帖

网页之跑马灯文字特效

//修改宽度. W  F$ C, W$ W9 A4 ~" }
var marqueewidth=300
3 M1 [) ~9 G! R5 \# T* g( v7 I2 {( K//高度
4 {0 A0 x( `& _var marqueeheight=25
* O1 w9 j5 ~6 H; P9 S//速度(1-10)! s3 \: M1 }5 b
var marqueespeed=3) ~7 H- i! d$ ^% P& S% E5 F- S. c
//背景颜色
8 x: i9 x+ b6 e4 f2 _var marqueebgcolor="#FFFFFF"- H/ Z$ Q# a$ V. i' V; k
//是否能暂停 (0=no. 1=yes)?
+ o! ?# H& u8 R  G7 X! Yvar pauseit=1) N" F6 {) U" S* ]+ V! k

, k: |1 ?4 G& m//修改显示内容
  j% c1 i3 |7 n( a6 w: [' Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 Y( o( Y+ \4 f  C# a, z9 M7 n

. \1 D1 k$ f  P  @
) a8 w" p# G2 [$ k////下面不需改变////////////) ]! W9 T2 g. s2 r0 p

& }5 g1 G. s8 b4 avar copyspeed=marqueespeed8 c9 g! M% k9 U. m' k# e
var pausespeed=(pauseit==0)? copyspeed: 0
- s+ g7 f$ l+ f; M2 y  z9 Ivar iedom=document.all||document.getElementById
% ]3 U2 v+ \1 W# i' E$ m! dif (iedom)% h  @# Y- H5 e+ d  o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 f. B. r; s$ Evar actualwidth=''
6 w8 q$ V) N! t% Z- q, c8 z+ wvar cross_marquee, ns_marquee
' y6 B% F" }' w4 r  j3 P' Y5 E+ _2 a- y
function populate(){
: O) g/ E- M% ^5 Tif (iedom){
8 ]) j5 f/ x, a: h/ t1 Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; E, g3 \/ e6 X3 }
cross_marquee.style.left=marqueewidth+8( y6 f% K  L, _5 n
cross_marquee.innerHTML=marqueecontent  F, \% C2 B! E$ B2 d2 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) z: X* \! B/ Q
}
- h2 j' {& Z. g: j3 P* G8 celse if (document.layers){
2 M; ~  j8 k" a4 e3 D7 Z# _3 i; dns_marquee=document.ns_marquee.document.ns_marquee2
! i7 I8 g* Z2 ^. Ins_marquee.left=marqueewidth+8
4 `* L: l2 h8 v! ?* d, T, yns_marquee.document.write(marqueecontent)
! Z. F; N# c) Nns_marquee.document.close()- h* ^0 f) `, j/ f+ m* a
actualwidth=ns_marquee.document.width4 R4 {/ [, d2 A0 k: M* I* ?) C' F- O
}
7 f- G: G7 D7 xlefttime=setInterval("scrollmarquee()",20)
; p" S  y/ @4 `$ e}
: {1 h. X6 o2 bwindow.onload=populate
3 i, K6 N, b& u0 J1 C/ j" r
% l# }. C* s# o. ^7 Nfunction scrollmarquee(){
! v# }1 P( {7 _( _2 `; R" r+ k. Qif (iedom){+ G$ h. g8 \" n" z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 r1 a- U9 s4 l$ @1 B2 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" s  v  a1 Z4 Y& I+ i
else. O) w, i0 O: z2 @& o$ O- F
cross_marquee.style.left=marqueewidth+8$ X- y( m2 v" j$ d& C

  M$ e% u/ V5 ?" Z( ~% G}
6 P6 e; s6 A- r8 i  Q; ]0 L/ xelse if (document.layers){
2 u, ?# W% ~! P- J* C- vif (ns_marquee.left>(actualwidth*(-1)+8))
( e' `5 e* |/ V7 W0 \- d+ l8 zns_marquee.left-=copyspeed, x. k8 j, ~$ G3 Q5 d, E$ F
else' ^4 h5 a" Y. g. @8 R" x
ns_marquee.left=marqueewidth+8
1 V, t8 l4 \$ z. r; d! z& X6 F, z* C}7 L; s6 v- u! Q$ @% @5 [$ p
}. O9 [0 s( ~# W8 B0 r8 v& l( |6 i
7 }  a6 ]' A9 c- D+ v2 N
if (iedom||document.layers){
9 A- a& `4 O+ k* Awith (document){
8 d0 c: \- c7 k, _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" q+ G" R7 l# O# r' J, {; Hif (iedom){
8 G7 y" o: ~" L/ f; W2 z0 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# r4 t) q; |& N) s; c( Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- h  [( G% e# J* ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ A; B# s' h, R% kwrite('</div>')# n7 g* v2 r; ]0 }! F1 y7 i
}
( O; Z. |+ l- D* eelse if (document.layers){
, z2 s( e2 a# [: Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). e  ]1 w- m  }  g$ X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ W/ F" A5 V! z  N6 u9 F! p
write('</ilayer>')
2 e/ A+ i+ Z' }" ]  J/ K2 m}
  Q! g0 l* H2 ]5 w1 I$ D, i7 Ndocument.write('</td></table>')
! }, s2 n/ k9 S% ]9 ]4 m8 V}# k1 C+ c6 S5 Y5 W  T
}
" d0 k7 [+ [. f7 [5 U7 C</script>

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