|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
" y. j* f7 d, Y% U5 evar marqueewidth=300: @# N. \# m* O1 ?9 u! S
//高度
; `2 B# t# ]. }5 r1 K9 l; g0 Avar marqueeheight=25
% C D/ o, I7 S" e1 }. G$ B$ k//速度(1-10)
1 }3 _& x- Y6 Z6 jvar marqueespeed=3
% N, T3 @% x1 {* C0 P//背景颜色
% ^* K. r1 B% l: N- q: e, wvar marqueebgcolor="#FFFFFF"
* X. U$ X/ K# A1 b. E; W( j//是否能暂停 (0=no. 1=yes)?" B U3 s, K% ~% H+ a' d# m
var pauseit=1
, O: x8 x% N) k# z& q/ u, ?% g N
4 |, d1 o% n! l/ p: \% {; K//修改显示内容
, g [' J- H2 F& s" Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 J2 X7 E! \% q2 X% k
7 G5 O6 ?5 x+ y" A
* J; b* d: I9 |1 [6 H
////下面不需改变////////////. U2 D2 ^: l9 t$ f# M
2 ^+ V% v4 T: c7 Evar copyspeed=marqueespeed
" i! ^% y+ J. h7 B2 lvar pausespeed=(pauseit==0)? copyspeed: 0
7 [9 T$ g) S* p% G4 R1 |var iedom=document.all||document.getElementById- ~$ ~5 F$ U$ r1 f! E
if (iedom), o/ L. i: B7 ~% ~$ L; P( S9 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) _# b- e. U# n0 t2 i3 Ovar actualwidth=''
6 }7 T8 S! T" x2 j$ V3 {# Fvar cross_marquee, ns_marquee
; V! s5 |% j& {/ g0 Z) I6 N! N3 v6 i, a% p: s+ o
function populate(){
4 U! Y* N8 @9 {7 _5 w9 ]if (iedom){' P- E/ X6 M2 S9 Q! ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- ~7 m* k8 i/ }$ K2 L5 M$ k
cross_marquee.style.left=marqueewidth+8) h- I1 o1 \" m. t
cross_marquee.innerHTML=marqueecontent" C, {% [0 z' K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- T [% ?2 R, p$ P% i" R}4 Z( K1 G/ U& C8 O: u) M& @
else if (document.layers){
/ l4 D% z* H: P$ m" ens_marquee=document.ns_marquee.document.ns_marquee2
/ \$ p% {% l5 p# ^; gns_marquee.left=marqueewidth+8
* G3 T% u6 q8 e: Pns_marquee.document.write(marqueecontent)# C( _4 t$ ^! v( A( Y# v; L
ns_marquee.document.close(); |2 S. p5 k/ ]9 q4 s7 Y' {( S
actualwidth=ns_marquee.document.width
* j0 W; u0 [1 `3 a7 G4 N}
; V% Z! ^! Q- d8 Mlefttime=setInterval("scrollmarquee()",20)( m) n0 y' ?* I1 L9 |
}# b5 @0 D" ]- D# _5 X- D. F( j& y
window.onload=populate7 m, {0 v# w% C) n8 S) U
[/ S6 [. V1 Y, ]! z. |
function scrollmarquee(){4 d) j0 N- Z( e/ ]1 E& r' h" s
if (iedom){
7 B* `/ |! C" {5 n4 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) r6 K$ A2 n: `0 [; f- Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed Y1 `7 i+ Z8 g
else
$ I: v- U- n7 h* C- fcross_marquee.style.left=marqueewidth+8+ n* w. W( ?# U2 D- i8 T5 J6 c
& _% x1 p3 V1 P% l' |% o; _}2 t& ?! n* `8 E
else if (document.layers){
4 e$ Q7 Q1 I; Y0 q" D4 Lif (ns_marquee.left>(actualwidth*(-1)+8))
+ g2 J. V" p @0 S1 {ns_marquee.left-=copyspeed
; [7 ?8 y8 j3 K" ]else
1 N0 j: V ^1 C- `- C( N: Q3 J+ Ens_marquee.left=marqueewidth+8$ e( y, B T- k
}
3 @& T* G. X; ~* l4 J}7 p1 Q+ u; z* N$ f
/ M0 F1 d5 v" X3 P+ Aif (iedom||document.layers){
0 I) K) c2 Y4 h4 z4 |4 e7 ~2 Xwith (document){1 |7 J v: u6 j! f1 N: F. Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, U5 j" V$ f) }5 Aif (iedom){
" k6 |3 v( `( k+ S/ d" L* E7 iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 n1 ~! {) C) o$ Q; Y- J6 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 Z8 n4 S5 C, ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 c7 m9 `+ F9 ?" Y5 n# ewrite('</div>')4 w, m4 p) B5 A' c. L# ?
}- A& w5 d ]( a& o
else if (document.layers){, `& v; ?8 ?/ [, ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 M* {: \( N1 B) O% Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 {( y, x* b# O( iwrite('</ilayer>')5 B9 J# a( r. c9 z! E# t
}
: y9 G6 z' f# d5 ^' m, n" [document.write('</td></table>')! `/ n: A/ h' r
}# q3 T: f7 p, i- K6 s+ [" d; ?
}& w( [; X. M0 ~6 n% h5 t
</script> |
|