返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; O9 X, h* @: M4 d6 w) T! lvar marqueewidth=300! x  S. v1 ~" N' o0 p2 d' A
//高度2 t% V5 X" s) \6 i
var marqueeheight=257 Y' A+ U% T5 f
//速度(1-10)
0 J% [0 u& {6 k7 |! ]var marqueespeed=3
# j4 G4 Z! a6 M9 \- T/ [3 w2 G//背景颜色
# z  K* B- V2 I: e; m, dvar marqueebgcolor="#FFFFFF"
/ r* V2 R+ F) j4 s' X- ~//是否能暂停 (0=no. 1=yes)?$ A8 L/ ]2 n6 T0 V$ V
var pauseit=18 E# i+ K% X, Y' t* \  U0 Z+ ^7 f
( z7 d  t0 z  g, I
//修改显示内容
) ^" j! ~; ^7 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 e; m1 V4 i$ f
: ^) z* j! h5 q. K5 W+ n% Z7 `+ o* B8 d
////下面不需改变////////////8 e) C8 A# [. b/ M! x- j/ i$ ~! M* }

  U8 e' ~- }* T; L1 D3 P* p" evar copyspeed=marqueespeed$ Q$ t7 f6 T' S  D' r" K$ g0 h
var pausespeed=(pauseit==0)? copyspeed: 0
* x7 [4 F: k+ U1 Cvar iedom=document.all||document.getElementById
8 d+ Q9 {5 @5 n0 Cif (iedom)
" c: Y" M% H; g+ Y0 }; H$ R3 ?+ G# Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ l- Q: M+ B0 u4 p1 wvar actualwidth=''0 u9 M: R; r  N. z+ o' _" z
var cross_marquee, ns_marquee
- \0 D7 a: |* X" V8 Z: I
- x0 j' v; {* u+ J6 |function populate(){
& ~6 y/ g+ L3 mif (iedom){
; y1 Z$ s  t: V. Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 c' e2 h3 ~- ]- q  Ecross_marquee.style.left=marqueewidth+86 h' f  a! L8 ~6 ?5 e
cross_marquee.innerHTML=marqueecontent
8 L% a/ p7 ~6 j. U$ Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 T7 f" e4 P2 D8 n0 J6 K}
4 ]! C2 p" I% m/ e6 x3 m: ~# Jelse if (document.layers){
" T' S$ g" s0 h3 ?- a. x1 r" _ns_marquee=document.ns_marquee.document.ns_marquee22 ?6 u2 i/ X% \* ~
ns_marquee.left=marqueewidth+8
( k3 J; C7 E; v) q; Tns_marquee.document.write(marqueecontent)4 o9 b! q; m, Q  ?: N& n
ns_marquee.document.close(), Y- s8 @/ p& W9 v  T0 U3 ^
actualwidth=ns_marquee.document.width
3 m/ M  u- \4 H7 A, T}
2 D! `* a9 |. Vlefttime=setInterval("scrollmarquee()",20)
; y7 {5 L# j& l}8 j6 f  g0 c) P# q4 b
window.onload=populate  H) |+ |' O# S5 y% W
, m# f3 t8 W/ I" |
function scrollmarquee(){
# o7 P. R  G) x5 Q5 t/ s  a! {if (iedom){
/ O2 Y" W& X1 u/ nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 ?/ m: C' h8 n9 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 I* j% w% s. f0 O- e; z
else2 c, J7 e1 s$ j& X  }
cross_marquee.style.left=marqueewidth+8
* J3 B& g+ ?# c6 C4 \) y: D9 Z! R+ P1 i
}. A$ v# u" s2 D) ?" ~1 `& c
else if (document.layers){$ _* z% B, b: h) y" Z% V
if (ns_marquee.left>(actualwidth*(-1)+8))
+ l# u- P8 _1 u) a* r( e  Gns_marquee.left-=copyspeed, C% L  O4 A5 @8 E+ a/ Y0 r, |8 ?) x
else" t7 \/ {) \. N4 r3 @! [
ns_marquee.left=marqueewidth+82 I5 @. b8 E: j! L
}# q3 r) x0 U2 V& b
}
# u) `6 h' g& q1 E* o" p: `7 |" Q  c# e
if (iedom||document.layers){0 T7 b$ J# ^2 b# _
with (document){
; a! G/ x1 g7 X! m! I  e( x/ jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  \. I4 q) l+ j( r" r, oif (iedom){
  R8 F; B7 {6 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 s2 A7 F3 B- w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& j0 u9 X# K7 {6 V! Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 ~% `9 j* V& ~- ]3 R( W% y0 v- lwrite('</div>')
. L( N& J( ?) K& P! E  q9 m$ q8 q2 n}& A, a. Y% \7 I9 X% h8 M
else if (document.layers){8 V0 j/ V; f; T! Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' F+ v3 e. ~/ u7 ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 x4 f9 L, D2 M% F! |write('</ilayer>')& J& n2 W! [- E: }* h6 G  N
}
+ b& F5 U5 m: s" Kdocument.write('</td></table>')
' m3 y7 j% N7 {4 a+ m6 s2 e0 g}
, r; n. z4 t+ D* w) {3 n, Q( F: H% s}1 x3 H: Q# t0 p8 m
</script>

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