返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 b& J+ x1 K/ b  V4 N: f8 Ivar marqueewidth=300
7 ~+ n- B/ q  n//高度; S  ]# ^( o6 p  j! F7 Y
var marqueeheight=25- x8 B2 s. Q5 P+ e. o
//速度(1-10)
# R1 o0 N9 T, O& avar marqueespeed=3
4 A# |+ l  A1 G$ L//背景颜色
0 {, b- d0 s  dvar marqueebgcolor="#FFFFFF"' H9 o2 V4 i; a& P
//是否能暂停 (0=no. 1=yes)?
) D3 K3 }0 Q- M; V0 o  O3 Xvar pauseit=1. k3 e- _- y* B" X9 ?& L3 A. \
  j' [6 y2 F2 d$ H
//修改显示内容
! e, n  Q  w" N; Q5 V+ Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' D/ _$ @. b. y4 J) k
9 W6 {0 F0 N8 h; q* b7 u+ o- i8 ~8 X% ^6 f+ n9 f0 _# N
////下面不需改变////////////1 y$ O) Y2 N& [2 P0 i* a1 t! j+ C
8 a% a# {8 T  K8 }
var copyspeed=marqueespeed
+ F" d* S7 K$ k; U- }- dvar pausespeed=(pauseit==0)? copyspeed: 0
- U/ V6 B' s* u- e* V8 i9 z# ^var iedom=document.all||document.getElementById: t1 Y  ?8 j, I" f3 L: `4 o
if (iedom)9 e$ E; N! F) O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" E3 F; }5 V5 f2 w7 y3 y# N; z
var actualwidth=''
' u2 D# L7 [' @  dvar cross_marquee, ns_marquee
8 |& v& \: O8 \! ?# P( ~3 I& z- f3 S8 s* O! T* l) r
function populate(){
3 M8 p+ h7 {% @- }+ kif (iedom){8 c6 m. K) a3 ^# R) `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 b. I5 I' A8 w" R1 f" r% Q) ecross_marquee.style.left=marqueewidth+8" B  b% T( w7 g; J$ E
cross_marquee.innerHTML=marqueecontent: l# N4 s7 _- V" s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  D/ y! a! f0 k}5 D* S* w1 q" S. s4 h. W. {
else if (document.layers){# Q/ T& H8 @( c- u+ s
ns_marquee=document.ns_marquee.document.ns_marquee2
) y$ y6 _( Y/ d  S- o, o) Zns_marquee.left=marqueewidth+8
5 Z% |7 g# i: V0 z( Bns_marquee.document.write(marqueecontent)
" w' k2 y5 j7 {) S+ lns_marquee.document.close()# P- [7 B! \( n
actualwidth=ns_marquee.document.width# R1 {, x$ A  T8 S
}
, [. G. g9 U5 q) g) u8 ylefttime=setInterval("scrollmarquee()",20)
1 a* H( p( H, C# w& n  {8 q}' t8 L2 l5 O9 H) A
window.onload=populate
8 p, g, k4 ]' F( g* `
6 z6 I2 y% M, f- m% }, t1 Qfunction scrollmarquee(){, n. y2 P# t+ P) B5 _! V" }# F1 f
if (iedom){
% d9 i/ y/ f, n7 T3 g) E2 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 l  B3 w. M+ V1 W& j5 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- `6 e. D5 Z& F: G
else5 G; ~8 V* l( L/ R5 b6 Z' P
cross_marquee.style.left=marqueewidth+8
! Y+ t# b4 I% s' {: ~" D* l
, D" O8 }& R) s  a3 h7 j4 ~4 I) E}; m% B: {: O+ a0 i- H
else if (document.layers){
0 ]/ G0 Z, |, L* K, Hif (ns_marquee.left>(actualwidth*(-1)+8))
0 M3 @1 P2 g5 R' P# r" U. hns_marquee.left-=copyspeed
/ \6 c5 o& k! @1 D6 R' ~% ielse; b) Y1 ]+ X% F( L
ns_marquee.left=marqueewidth+87 V: _& F  t: m$ P
}+ S5 O0 Q, E! {, H; {# F) Y
}
; P0 I% U/ `' f! E" @6 n  S) {
/ u& p/ q: i# [" [if (iedom||document.layers){
8 }8 p! G/ F2 N. d) `) m* n6 f2 Vwith (document){# s3 Q9 _3 Y7 b% `0 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  q" v( _: H+ z; Eif (iedom){
0 K/ T/ \( ]/ {$ ]1 u/ B; Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% Z7 L( V, l; S) H4 n" m* k- @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ], w) _: }+ ^$ p% m1 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- o+ Z$ ?2 N8 c9 [/ K
write('</div>')) d$ W' d9 F1 @
}
  j! U3 E; K8 [" }9 eelse if (document.layers){
" g: F  U% j: D5 n: gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 j, v- p: _  p! ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 O2 L0 a7 H0 X* ?. V/ s8 a, D# n
write('</ilayer>')
5 S1 n+ X0 f; S3 }5 o: M}
( V9 U+ B% x" u# L0 A" Q- Cdocument.write('</td></table>')& w, o" n; i5 I3 b
}1 }7 n3 v) _) K$ }2 _4 \
}
, ]9 S- s3 s( Y9 {</script>

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