获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度  l4 m! t8 `1 ]6 P- p6 E, m( z
var marqueewidth=300
! i$ B/ ^$ @" Y! `' [& L7 j//高度
2 A6 T% G3 _* }var marqueeheight=25
8 v0 @. M' D) W& F//速度(1-10)+ ?) s1 U4 X3 ~3 D
var marqueespeed=3
4 x# x6 {* b5 A# {! x. \//背景颜色4 q2 ]2 Z' c5 i3 M2 v
var marqueebgcolor="#FFFFFF"
( `& k4 }, j& O//是否能暂停 (0=no. 1=yes)?
2 l4 H1 _+ k+ y( ?+ N' Zvar pauseit=1
6 d8 `: r+ G9 G. I- P" I
0 l+ z3 u% P3 E9 b//修改显示内容
3 D( N3 P, U& [8 T7 hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 d; @! v7 ?' I: f0 I

" R2 j3 v% l8 ]8 {" ~% |7 X! S% o- ~7 c& A% J
////下面不需改变////////////
$ ?/ r% x$ ?0 H( \- Z
! |9 e) u2 x/ I" ?) b3 J. D9 Zvar copyspeed=marqueespeed3 g! T  v! c0 p# a; T* H
var pausespeed=(pauseit==0)? copyspeed: 0
+ }4 X7 a- n/ R) T( O) Svar iedom=document.all||document.getElementById) e/ l6 _+ s4 w4 L
if (iedom)- k$ i% w% ?; [* {+ |! E5 v- X5 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 v$ R: p/ S7 z: D
var actualwidth='': l* H. {% s6 h4 o8 U
var cross_marquee, ns_marquee
" N5 X! f7 ~- Z  w: t7 g0 v- O  \& g  p! W/ F5 v
function populate(){
8 [  \4 I' b& I  R% X, Bif (iedom){
- y# ~) Y8 j3 [- q7 {: kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, {" u: @0 ~) Icross_marquee.style.left=marqueewidth+8
& b/ `2 r/ Q$ S$ Bcross_marquee.innerHTML=marqueecontent
+ {0 E7 `4 m( K5 i* ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; [+ a. j  ?7 _/ C}
4 C' _# ?/ w$ r5 Nelse if (document.layers){
& C3 H( l. u0 O% a- P( j; vns_marquee=document.ns_marquee.document.ns_marquee2
4 m2 L1 C/ C, n& D. hns_marquee.left=marqueewidth+8
# c& ]% K: o% Y( |ns_marquee.document.write(marqueecontent)- a3 z5 B  G; g, N# r
ns_marquee.document.close()" e7 G) B( e# E" Q
actualwidth=ns_marquee.document.width
3 z* @! s) [/ n}1 P& x5 Z6 {1 h* ?
lefttime=setInterval("scrollmarquee()",20)  Z! }$ }! H( h- H
}0 u2 E) t* e3 v  @: M! ^' y3 M) z
window.onload=populate: S3 N' _" j9 H2 i" G
& }" |% A+ u1 o2 i0 r2 L
function scrollmarquee(){4 i* c4 B# Z& H3 D2 [$ w, X
if (iedom){
/ a" ~: @. I; C/ C+ t, [3 U6 Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); X& ?* a, R9 p  Y* R, G' X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  _% N2 O) s6 s2 k  r
else; E! l8 p, g& p; C7 o4 }
cross_marquee.style.left=marqueewidth+8
( J6 l$ R$ \7 I$ `3 `4 _! n( ]
3 e( e; H  X( i( p}% v  j3 M; j6 `" w5 z( y' D% Y; r# x
else if (document.layers){
% H7 Y# k4 v- Sif (ns_marquee.left>(actualwidth*(-1)+8))+ l% D: u9 H0 r+ |1 }, W, d; N
ns_marquee.left-=copyspeed
, Y( W& e. B: m1 R' w1 A% pelse
5 ~& R( y% g) F& `* C! bns_marquee.left=marqueewidth+8* `( }% m5 |( M3 {" [% `% v9 }7 P
}
: ^. s  l. M; Q' u3 b3 M1 ^- X}; ]* A+ C$ m0 v9 Q

  ~' I' _7 a, c: A+ }$ jif (iedom||document.layers){
  o9 ~+ j: v- A$ V7 R, ywith (document){- h9 n, l# Y, b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" U$ L8 ?  g) _& ~. M. oif (iedom){* d( I+ C3 c- Q1 ?( \7 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ d. o# O3 s+ b9 `; K4 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 X% e& X2 F/ M  h% [8 a1 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) j& L3 r4 m3 T7 x* P( A7 j1 A. dwrite('</div>')
! n$ A+ [6 q& o}
$ D5 k; h; L6 X- F" A7 Qelse if (document.layers){: n8 a/ I7 R# k+ H( \2 M2 o8 r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* q. X; s: {+ I3 R8 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 Q- X5 U7 X# d  q; s/ v( jwrite('</ilayer>')
; {* i$ x" X  w5 S5 W1 l9 q}/ k% M5 S$ O, A4 q  z. I4 L+ [
document.write('</td></table>')" s7 P$ V6 F  r* I8 I" {7 g
}
8 c  P5 W7 f% t) T1 i) T; Y}* a. h6 J  K% ]2 n8 S
</script>

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