返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ {- O5 K: i3 Z% W9 uvar marqueewidth=300
5 ]- N8 z6 S7 c* T+ ~* Y//高度
( l+ J4 g; l( _0 `var marqueeheight=25
* [" s+ g5 `$ S- z- s; Y4 w8 Z0 P//速度(1-10)5 g; S6 t' ]' A$ B7 v
var marqueespeed=3
# y5 l2 c: ^6 D& |//背景颜色
$ F6 B# ]1 p0 V. r3 H0 k& \- x0 Ivar marqueebgcolor="#FFFFFF"
6 l. U" q4 J% ~  ?2 G//是否能暂停 (0=no. 1=yes)?# F9 s5 F+ ?7 H" o0 \( r
var pauseit=1
0 |! X. v$ D5 O4 ]! L, x4 n6 a" l. S+ q- z/ ?
//修改显示内容
8 L0 y7 {, Q4 n7 Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 s* l3 E( }1 E8 c" ]3 z* O* b7 [' t, l5 C

9 v2 V9 B% O# e* }6 y% e! C7 j////下面不需改变////////////+ _9 q! O$ @+ p1 G  z9 y5 ~
4 A( t" r7 n6 A. D% _, O6 @+ y
var copyspeed=marqueespeed
: c: C: x3 w6 P* J2 {var pausespeed=(pauseit==0)? copyspeed: 0, Z( [7 D$ B7 U" i: }2 U
var iedom=document.all||document.getElementById
2 [+ Z" z; X8 N7 Xif (iedom)6 T- @' s+ F  E8 f: _: e; f& K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ K+ @# U' \8 L; h1 Z
var actualwidth=''/ n/ h+ T4 j7 j- Z1 T
var cross_marquee, ns_marquee5 D% X( u& `, ?6 t: P/ \0 d7 l1 h

4 O/ J4 X. U5 V" s# R; ~/ Vfunction populate(){
4 J7 q6 ^% ^# `: Y& Oif (iedom){
0 b. `: v+ V. r  Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  R2 e0 V6 t" J+ |$ n/ ~cross_marquee.style.left=marqueewidth+8
2 N$ x( h" l2 ~8 mcross_marquee.innerHTML=marqueecontent
' W# ^% G, y" A+ Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 i  d5 k$ `: i5 y  G}
; ~$ V+ I2 |; P! }else if (document.layers){4 _; U& w7 B& O, F6 m2 s8 J
ns_marquee=document.ns_marquee.document.ns_marquee2: M1 i7 V3 C5 T0 @) P2 ~0 _
ns_marquee.left=marqueewidth+8
$ x2 n: {) Z0 x+ S) xns_marquee.document.write(marqueecontent)
& d' m7 F6 t% ~ns_marquee.document.close()
/ b5 u- Q0 w: B2 V  f- iactualwidth=ns_marquee.document.width
7 k1 e/ ?2 U: f5 ?% C}3 E9 z; o" l2 e
lefttime=setInterval("scrollmarquee()",20); T8 \2 B  P9 ^9 r! D  @9 P. G8 R
}
( v) I2 o6 c: g/ Z% hwindow.onload=populate4 d* j1 r) [3 r  H! }
, m8 L9 k) C. W" \7 _% A% S( Z
function scrollmarquee(){: n7 q; J) F1 U' Z% ?1 K
if (iedom){
  r% B) y" w) i$ ]9 f1 a/ I( ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ r# x, p7 H% o4 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 m) X% d( c; b! helse
! m3 L0 _3 r; e8 Rcross_marquee.style.left=marqueewidth+8$ b! P/ Z! D# L( a; K
0 X: B$ m0 _/ Y
}# U% Y. i& {( Z" d) `" S, p+ C# ~! g. n
else if (document.layers){; R+ b' H; h7 T* g6 A
if (ns_marquee.left>(actualwidth*(-1)+8))
- D5 S1 l1 j5 v2 J  ?9 Z) t) |ns_marquee.left-=copyspeed! u3 z: ?5 t: {. f8 B4 `7 E
else- D* [& c4 G2 Y1 Z8 J
ns_marquee.left=marqueewidth+8
* \/ B+ _/ Z" J% ^6 E9 N}0 I% a; u9 ]; U8 k# O
}/ r  n* `- K% M: Y
9 |$ m1 l) V: K3 A# {9 p
if (iedom||document.layers){3 ^1 Y3 ]# S8 ?) y% i, _5 a
with (document){: c1 b7 `9 B6 c  W+ a. z1 h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! {2 \4 e0 n" ?2 G7 ~0 I4 v$ ^5 b. y
if (iedom){
0 w8 R7 ~7 s! v" s! f  n! t6 bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 O5 w0 J: c9 @2 l( d3 S, H; ?8 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' L6 r, n5 e/ B' t* u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# Z4 X( G' p/ _+ j' Y) U
write('</div>')9 L& m+ H8 |2 I( n) p) W! r2 H
}/ }# E- T" E0 z9 R9 n8 K2 c
else if (document.layers){
4 U* G) n+ E9 x, q. q3 N) ]* Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 w2 K3 J2 I9 T; s% l  [+ P" Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  d* s4 p0 Y' Bwrite('</ilayer>')
$ T3 u5 ?" F! P1 U& U}
" e+ t- _" C* b$ gdocument.write('</td></table>')
& ?# h& \3 V$ i& W6 B9 n: ~}
. w" P" P( S0 v. i5 k}
0 n3 E% U% J* {, r</script>

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