返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 A6 l" N* H8 H% Y" ovar marqueewidth=300* O, l+ \) m, \) o
//高度& j) E  r- s/ j! Z& ]7 e
var marqueeheight=25
7 a0 T+ U8 y! q8 g% w9 t' M& X//速度(1-10)
* P  ]6 s8 d: X# f) Kvar marqueespeed=3
! q2 R. D3 |. ~" w//背景颜色
/ d- R0 D& t5 u3 J( S  N7 Avar marqueebgcolor="#FFFFFF"
, c6 @0 X2 M2 i: U$ a9 I7 K7 w//是否能暂停 (0=no. 1=yes)?
8 A3 J& b3 M# L9 A) n% Hvar pauseit=1
, Q& J. s2 i( ~7 y3 }! q! j3 z2 N6 O8 }# ^
//修改显示内容
4 {0 @: H" }  m$ Q# ?+ ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# A; A: ^% j1 ]5 h) L4 g" `
4 r3 I* m7 C$ O" K. |! A/ [/ `- _6 i8 i9 m9 K, D$ [
////下面不需改变////////////' {# ^6 W: L, q! z6 `, I+ _8 y, |& B

  g6 M6 g% @' i& k8 z( P7 p+ Y: hvar copyspeed=marqueespeed
8 Z  D0 j. }& Dvar pausespeed=(pauseit==0)? copyspeed: 02 M6 k) V8 _% \* N" @6 ~  [0 w
var iedom=document.all||document.getElementById
- d/ j2 {+ m' i2 h. m3 }7 Kif (iedom)  q# M- q* w! A+ p& P8 f0 ~3 M& L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- W+ l( ]8 w' r: v9 }' ]
var actualwidth=''
/ e# D' M' l# {6 V1 z$ [5 Evar cross_marquee, ns_marquee
+ I; h' ~( H% ~# l" J) ]$ P/ o9 I* j0 y: u3 L* N$ F$ y
function populate(){
  k6 a6 m1 E+ F* h0 i% j2 Pif (iedom){
  G$ O7 k8 x- q( L0 ~) ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) G* F9 n0 B/ J' }cross_marquee.style.left=marqueewidth+80 G  e4 h9 F0 W$ D# R9 m/ U1 \
cross_marquee.innerHTML=marqueecontent# T7 [* K. b0 v5 Q1 @' ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 C; m) v, f: m$ J
}7 k* J0 l3 Z' u5 s
else if (document.layers){8 {( q2 N+ L9 Z* @! B" G# W4 S
ns_marquee=document.ns_marquee.document.ns_marquee2
5 p7 `" y1 O& x1 Dns_marquee.left=marqueewidth+8
7 \( c" {7 H# ^/ \  ^, F$ Wns_marquee.document.write(marqueecontent)
' W+ O% @6 n  a+ z( J- [ns_marquee.document.close()
1 n3 c6 C  Y8 yactualwidth=ns_marquee.document.width& |  E1 J+ g: k2 ~
}) o# i- `7 x. Y
lefttime=setInterval("scrollmarquee()",20)
) ]' b: s2 _1 u/ Y4 ~- ]}
* z% P3 d/ J  j: c" U# ~% C# Iwindow.onload=populate
; \' z. P' f; x
* ~5 P5 `& S# w) w0 l" Nfunction scrollmarquee(){" t% T$ t! `* p" G4 k
if (iedom){
; O9 C5 [+ f- J8 ^( `5 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 g. z9 _* x( ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& ^* {; v! ^7 f
else
% s, @, L0 C/ f; g6 W" z/ l, d8 rcross_marquee.style.left=marqueewidth+8
$ c0 s8 e6 S- @7 m& c, K2 A
& ^* H! b1 c8 w* d+ L}5 W& n8 e3 o% a+ y$ Z  I
else if (document.layers){2 d- ^! |% A$ R  W9 W$ P- T/ }
if (ns_marquee.left>(actualwidth*(-1)+8))9 H4 z, _4 u1 c. V" i! v6 ]" A6 l
ns_marquee.left-=copyspeed
; o8 G+ X7 p* o# Jelse% X* V( m% j, X- x
ns_marquee.left=marqueewidth+8
3 H: E" J$ d" C& ]}" C/ e4 ]9 e% k' @- U3 u  a
}0 u) ^, k. k3 F

4 |6 I1 L: V' V% H/ J4 I# cif (iedom||document.layers){
4 m$ _( I9 U6 F+ G* ~2 d8 A& m: wwith (document){
0 r3 w- h3 s8 o( h" ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ e7 f% N: G* [' f, ?if (iedom){
) s% _! T! w5 H3 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 W- y, a6 E2 v! V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) S8 Q. m5 x) \( E1 k, |% c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 H- G  n  ?7 [1 ~! A+ Pwrite('</div>')
3 c! Q& E% X: S% A/ L}9 \" ^: y$ L1 B! J  V6 n0 z
else if (document.layers){
' E9 s" q4 Y! ~- ]9 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- L. e" I6 p4 i- Z' |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). W+ o, ?: {4 t) ]7 `' M' {" h* R
write('</ilayer>')& C; C6 E  b1 B: E: u
}/ \& T* Q- R! C( D( W7 R
document.write('</td></table>')0 l) {+ X, |2 B+ @" I3 G
}
6 Z+ K' Y6 }# C5 N% i}* D6 F9 a! e7 g1 W  F4 p1 F8 J' x
</script>

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