返回列表 发帖

网页之跑马灯文字特效

//修改宽度; s) b8 D' C' \7 ^! l1 v4 U
var marqueewidth=300
* k6 \- B7 d4 j  H//高度; {9 H" ?: C1 I* }6 P3 i
var marqueeheight=25, @8 Z3 r- @2 {# j# c
//速度(1-10)/ V- Q  T& n1 L1 _/ y# b5 P
var marqueespeed=3. b+ S$ n# U7 M# [
//背景颜色7 J, q+ S' A. {( K/ T/ D
var marqueebgcolor="#FFFFFF"
# ?; B2 h+ _6 {/ P8 S+ N. \0 f//是否能暂停 (0=no. 1=yes)?, j/ ]; i* h) R/ s! `6 T
var pauseit=1
- y& F% d3 n6 _/ @% }. |* p+ n  U
- M2 {; j1 l, E# i; _" r//修改显示内容# R) l: N  O- _. W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ K9 ?' M8 k- l8 ~1 S9 r8 [( o+ f* R8 }9 ]. y* c5 d2 }$ j' }' M* [

4 Z# E7 j: y/ G4 C5 s1 w. D////下面不需改变////////////
9 C& Z, {( Z3 N
) s) u+ x( G0 Q$ a9 R5 d) fvar copyspeed=marqueespeed, o& _6 I& R/ _. q/ V& [& }/ w
var pausespeed=(pauseit==0)? copyspeed: 0
1 `" a' G2 `5 X$ H3 o* u& V9 Q) wvar iedom=document.all||document.getElementById
' w2 K" u0 {- ]# B  Y, Dif (iedom)
  w8 E( ]' N1 S8 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, s/ B' D3 S4 _: d" x, ]4 e5 uvar actualwidth=''
' ]0 ?6 z6 n$ t+ C3 @3 |var cross_marquee, ns_marquee
7 p, v5 P0 u, c: c, r' C8 q- F( j' P0 t' q) E
function populate(){
7 Q" R8 {% T7 v- Wif (iedom){
! S& q: b7 g& `( `) Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* E; C0 f& C' O/ _" zcross_marquee.style.left=marqueewidth+87 |9 K+ a8 ~8 {; m
cross_marquee.innerHTML=marqueecontent; l, R5 o8 |6 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! d5 @# b: r& V# G}1 ]# u- P) @5 \8 Y+ b# {2 x1 A
else if (document.layers){: G1 S/ d# a) I% z
ns_marquee=document.ns_marquee.document.ns_marquee2
2 G" [6 I( x% D1 Q: ]. Cns_marquee.left=marqueewidth+89 T, @3 `  `0 f0 {" y9 V) J$ k
ns_marquee.document.write(marqueecontent)
% \( y- B5 P: z7 l. K4 I6 i. ^8 `ns_marquee.document.close()7 B+ W' g4 T! y* b- f
actualwidth=ns_marquee.document.width
; t, B, c4 Y* C; P; l) J}
) H, n; r0 M/ p6 Wlefttime=setInterval("scrollmarquee()",20)
* N) ~  {: K5 i! X# Y}4 u) H* P' D: Z) G3 _
window.onload=populate
4 F0 C. }' S8 N+ m8 D5 J$ W5 C7 O, u7 K1 M, [* B
function scrollmarquee(){: j: ^8 E$ I, i. }
if (iedom){
) D( ?3 T$ q6 Y0 p: b: N" Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ I3 Z; Y- ~) U3 {' B/ o2 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: J$ g. E2 Q1 o9 J2 L& f) S% ?; Z, velse0 u3 K( l8 S$ `: I
cross_marquee.style.left=marqueewidth+8
; H, k2 R; u% R$ h
( P# Y9 f- U) _- T/ B- M. h8 ]0 x* |}
5 U- {. B1 E0 J: H9 celse if (document.layers){
% s7 m9 N/ l1 S6 _% ~9 {if (ns_marquee.left>(actualwidth*(-1)+8))* {) i, y" {) }
ns_marquee.left-=copyspeed& U- i! l1 X+ W3 i2 X. c2 V1 B
else( N3 ?4 t6 p. h+ q
ns_marquee.left=marqueewidth+8
! x4 h; t; r- S}
+ ^) ~9 m2 P+ @5 }* p}
* a# ~4 b. a6 p+ ^( R# D& b3 L1 G; n
  ]+ K$ Z; X- E! @if (iedom||document.layers){
) \5 c8 O8 p1 A& ?with (document){9 v- G* q: a5 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- N' a. v* r# k2 y5 \1 c! Y, f( jif (iedom){
1 U/ i; J' [! W. @% e7 I  Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 c( I8 H; S3 F5 c% x6 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 q+ T* V+ _' N" f; o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- z( {8 r9 V1 ?9 d- Rwrite('</div>')
# k1 U2 q9 a  n& [+ s6 D}
$ {4 S" s( A% w/ `8 q% kelse if (document.layers){$ K3 B+ T3 b, [# f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- }: I5 v6 ]7 \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 C0 ~" Y, X- Z0 e; a$ H0 h1 pwrite('</ilayer>')" j- B0 _: b/ ~/ n! q  O2 G+ e
}
" p$ x+ ^" V7 l$ ^# udocument.write('</td></table>')
; Z" B8 [$ `$ q& V}: L& j( S! p6 L! i
}
' V  Z7 T4 {- A</script>

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