返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* M# E- I$ F9 u, evar marqueewidth=300/ e3 }' b# O6 l
//高度8 K+ ]. K: r( T9 r2 r: K% Q+ \
var marqueeheight=25( }5 r) a" Y9 f) x5 F! `+ C
//速度(1-10)4 ?* @2 b, k2 Z
var marqueespeed=3
0 P9 B3 F" S7 t, P//背景颜色
; t0 J5 }. S: f+ f. i9 c1 `var marqueebgcolor="#FFFFFF"( p1 X/ i" P8 d4 }" F. b
//是否能暂停 (0=no. 1=yes)?
: U, m! D* L& ~4 Q: ?9 N) g+ j, N8 lvar pauseit=1
& w1 c- P2 K$ g# o% j
* k; c6 B4 f, G/ E0 y//修改显示内容
2 `: K8 Q1 M! N$ B" i% N/ @" e8 [0 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. X% D; o/ K: F. T  [2 D

% n8 z0 s3 `3 v5 L
3 E( w$ K  k, ~& l% g- W////下面不需改变////////////
: x& y- ?- X+ E" D( q+ a- ~! A6 g: t
var copyspeed=marqueespeed
! z3 |4 A" Y* G; j& `: _& e9 Svar pausespeed=(pauseit==0)? copyspeed: 0! B( j1 n0 {. X. X- w/ b6 {: M
var iedom=document.all||document.getElementById2 q* D. z8 f* D0 N& c, }2 }& M
if (iedom)
, C  Z& i% F) W; a5 o: \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 t; a5 T7 {/ ]- }
var actualwidth=''8 E0 j4 S" R* w& }
var cross_marquee, ns_marquee
; n- q+ R# E; Z3 H3 s# {4 d+ P  `, P$ `
function populate(){
: M% ^! o. k  ^! [0 ?* [0 H% b: [0 Dif (iedom){
  n! c5 g$ x- n$ t5 s1 C3 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ w% ]# E% c* c- {7 Xcross_marquee.style.left=marqueewidth+8
6 b) |$ U5 |! [- Y, J1 j& w/ kcross_marquee.innerHTML=marqueecontent
% C& V" H3 O, }5 u1 o1 Y& j8 b9 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, _- d9 o* J% R& a6 M/ |3 ~}6 c8 z# K2 ~" R: G- \4 ~$ ?
else if (document.layers){
% Y5 G9 }% x2 dns_marquee=document.ns_marquee.document.ns_marquee2
- u9 K+ F( p+ K8 `5 cns_marquee.left=marqueewidth+88 c$ s6 g, D5 m& t+ Q
ns_marquee.document.write(marqueecontent)
$ A! g- d+ ^  z; q; F* V1 @/ @5 dns_marquee.document.close()
$ T5 z! G5 _; g! lactualwidth=ns_marquee.document.width9 C3 _' T) L3 J9 B3 M% L
}
- }, F/ J& [+ o# K7 x. K& y, v# n$ |lefttime=setInterval("scrollmarquee()",20)
' ]1 m( H6 I! w2 }}% j. \0 U$ [) b0 g
window.onload=populate
3 d. O$ i# {  Z! |7 _. @2 [8 s
/ m( s! u; V+ A0 A8 ~0 Cfunction scrollmarquee(){
6 o! [. S# F+ E, N' e" Eif (iedom){
  a# b7 I6 T. Y" U4 Z# eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 a/ _+ ]4 V+ B5 Q0 \8 g2 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 u# [9 e* N4 l1 Welse2 M" [  W& f3 f* ^5 C
cross_marquee.style.left=marqueewidth+8
3 O( s+ Y, n6 x; Y' }- d
  T$ B6 ]" l5 v; P; M# ~& b" h}$ V) _; F5 N/ Z
else if (document.layers){! p( \  `3 z: B( G3 P$ C# L1 D& N2 |, N
if (ns_marquee.left>(actualwidth*(-1)+8)); Z: D/ k6 c& n9 K% Z8 ^; o3 |
ns_marquee.left-=copyspeed
  U! S" P7 b' K% H* Relse, Z, d/ J2 f/ p% Q. n+ m# ?
ns_marquee.left=marqueewidth+8
& R) g% k- ]5 Y( K}
* Y# B( V1 z! |  Z' ~4 Y}" r5 c  b6 F3 U% m7 G- ]  V2 w
2 x! r( l0 R7 d2 A7 g6 r
if (iedom||document.layers){
, ^+ a+ z: Y8 h9 y. Cwith (document){: F3 u- o; @% D% Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 ^. n) k0 S3 o9 a& Cif (iedom){
3 j6 ^, p+ W$ Z" y4 ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! B0 B5 q3 ~( S% }" B9 x* bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# `3 X) B/ A+ D! P" ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 F' C( ~3 w% Q$ k6 X3 P8 r
write('</div>')7 K0 `( n  `' c  _0 h
}
3 Y" a4 M! p/ E* D% Z' Celse if (document.layers){/ V6 V1 ?$ X; [: T7 J- M1 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% H" v% C, M7 }5 b" awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), N8 C: ^" B% G: g9 `, P1 g! A2 m2 p
write('</ilayer>')2 V, M7 Q7 y: a' ~* b4 q
}
3 _  h8 S. p; Cdocument.write('</td></table>')- |3 W8 X" D, E# K3 i
}5 Y& t) c# O& B# G- i- o
}7 S% g9 c) h3 c- `
</script>

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