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

网页之跑马灯文字特效

//修改宽度
1 n- O$ U. f% Q8 Avar marqueewidth=300
, W" ^! E% }+ z7 k: j$ i9 d+ p) Y//高度
, x! H  Q' v) F4 f9 n2 |0 }var marqueeheight=25
! j# D4 E6 M. w# W1 o! Y$ B$ E//速度(1-10)
6 ]9 m- C& p8 E; |" r, p; C& Q: Uvar marqueespeed=33 x, ?, U2 `# R) h( M: [; l  Z
//背景颜色
; m, [9 }( s% [0 K  C/ kvar marqueebgcolor="#FFFFFF"
# ?; t7 _9 d3 d% Y) a( m//是否能暂停 (0=no. 1=yes)?% A, L! W3 L; Z3 ?* A( b
var pauseit=1
* i5 x% v$ u5 _9 O- V. k6 i3 ~& C/ o3 u$ ^
//修改显示内容
( ^3 R- S+ A$ Y) p+ wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' I# ~4 v4 [9 Z" [! M! Q

# k8 F# U) a0 ?8 ^  u, m! `! k  w
////下面不需改变////////////
2 R2 j6 R% `! g# W+ ^+ e8 r
8 x- r8 V0 g( F! q3 L* S* }7 B9 Lvar copyspeed=marqueespeed
, F/ D' g; v8 ]4 f6 P. \6 ^var pausespeed=(pauseit==0)? copyspeed: 0
, m' {! T: O0 J4 c! W) Kvar iedom=document.all||document.getElementById- y2 ?) ^! J$ B) o8 M- V* p! y
if (iedom)9 M  T% [1 b( l! Z  g! c) g9 Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# X( ?: B+ t6 v2 I$ I- j7 Zvar actualwidth=''; Y/ ], U& M+ D* }+ P. K' n& h
var cross_marquee, ns_marquee% \( ~! i/ f/ g- v
0 m6 V7 F/ z0 j/ A7 I
function populate(){
$ g  F: m) I/ \3 h; `9 j; Yif (iedom){
  R! m  g  H6 D  e$ g- t0 l/ b! fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ T% a% t5 g+ {) h' s7 A1 u2 o1 A0 Qcross_marquee.style.left=marqueewidth+8" s* G* d, ^0 K0 @$ j* B' f
cross_marquee.innerHTML=marqueecontent
7 K% }0 H- W9 W+ H4 S  d) \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# i3 s. s# A) Y- ^7 k}
1 F0 s: Z; V$ |( I. \4 T2 M" [else if (document.layers){
9 ^& D$ q+ h: }: {6 Tns_marquee=document.ns_marquee.document.ns_marquee20 J" Q7 |' X  |5 I2 x4 t
ns_marquee.left=marqueewidth+8
0 H0 M( }  W6 Tns_marquee.document.write(marqueecontent)
( v6 w/ m; v/ ?( v# t3 jns_marquee.document.close()$ U: Y. T" x2 z6 o
actualwidth=ns_marquee.document.width+ G; I$ [& P+ m
}- |; k1 O/ d6 l+ ^
lefttime=setInterval("scrollmarquee()",20)$ |# o  f3 E8 [( N7 d7 P
}4 I- k* W9 \! x! h
window.onload=populate, D  s6 d1 G" }( x' S

$ \7 [" Y. J' W$ H9 o7 E/ q5 j  jfunction scrollmarquee(){
' A2 V. D6 K2 Z* X! H# J3 wif (iedom){
2 L) }1 l, \' M5 m1 K" oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# I2 S- @+ b0 H5 x4 b. c6 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 G9 j1 H6 w6 {- q
else) t+ E! p3 F- p, P/ `& d; M# w+ e2 M
cross_marquee.style.left=marqueewidth+8/ o0 e4 P7 M8 D. S( u- H! n
  A# C& l6 |+ \/ p
}6 w/ u& q3 d8 U0 C, I# j
else if (document.layers){
+ l! K; i' P+ r/ ]3 aif (ns_marquee.left>(actualwidth*(-1)+8))$ a( L. B# U4 L1 x- X
ns_marquee.left-=copyspeed
% P4 V/ |% J4 t' T- t/ F4 yelse' n) a  P' @+ D: g, A
ns_marquee.left=marqueewidth+8/ M( y4 b9 O: s% o6 @# u
}
* ~1 c% M" a$ Q}
& l6 J( |0 L7 T$ t
0 B& o8 O. z) W+ ~if (iedom||document.layers){+ `/ T& N3 y( T' D  j
with (document){! M/ d' [; h. q1 f1 A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 `; G0 f9 j: iif (iedom){
# y7 `0 E+ k: k1 x  i3 W8 V/ _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# E- s1 M, ^( y6 z* dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 F7 o9 m# H5 w* ]( O$ h  b3 M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); ~9 {: Q, j+ J: X4 @7 S: g
write('</div>')
0 \: Z8 T7 J, X! k1 `}" x( a( d2 q( B+ U  \+ y7 D
else if (document.layers){
2 [* C" |0 m6 Z$ [! w" G% h. Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 Q! l  T1 R: n* H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, W% Q2 t/ R9 r( S4 }write('</ilayer>')1 I3 l. I- I. c9 e4 M" t
}
; L- f/ U. D6 n! w2 \, _# g5 ndocument.write('</td></table>')( [! J5 A/ g& K% D. k" f2 D& E( N
}+ r6 ~! d0 r, ~0 J: y5 r
}
* j6 j/ Y+ q; m, I! ~5 V4 c& a</script>

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