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

|
网页之跑马灯文字特效
//修改宽度& _- J1 \- G5 L" y
var marqueewidth=3005 Z' d$ @" Y M; J; B
//高度
+ w9 Q; n! z9 T0 U7 kvar marqueeheight=25' S7 Z( z3 V4 Z
//速度(1-10)
% Q) c$ f/ L5 W2 ^. z, c) Evar marqueespeed=3
% v5 l+ x h! E& m/ i0 K( j//背景颜色. z( D; q) x0 P, {# ^& A( D* i9 S4 `0 p
var marqueebgcolor="#FFFFFF"4 _# e" Y5 y e4 X" v/ o# W. `
//是否能暂停 (0=no. 1=yes)?
2 t2 @1 M1 w: j! hvar pauseit=1
6 v: C' c5 n+ h! e# f- N8 _6 }: F; i: b& y
//修改显示内容( Z: n1 e9 O2 t, Y" i7 h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: i: n( E9 R" @- F4 Y3 Y9 y1 I Y) d g2 N) K1 A, P* `: m
0 D% U: f* X9 i( D$ R
////下面不需改变////////////; q! a* I! C8 U- Z; a
, {) z% |( U( M9 |' `2 ]# M' {0 e
var copyspeed=marqueespeed, e1 z( k$ _ c) [
var pausespeed=(pauseit==0)? copyspeed: 0
1 }) Q& k% z. g- Vvar iedom=document.all||document.getElementById" u5 B$ ~! P) l6 V2 m; c
if (iedom)
; |4 n6 U/ t" fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): m9 H- a5 c. E; x3 _" x
var actualwidth=''* Z% F6 {; l1 r" `7 _0 l# o
var cross_marquee, ns_marquee! [& _% K T- J4 X5 L
5 C6 M- A* g. y$ r3 r) O4 `" b' E
function populate(){
: v w3 p: v7 N. B7 t" c0 Lif (iedom){" b) s3 {' T7 M/ S2 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: ~* M9 Q0 E- l# L; N# B) ^& @) H
cross_marquee.style.left=marqueewidth+8
" V: l; W. X) Tcross_marquee.innerHTML=marqueecontent6 b& j* |( L' W" @" ~& c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, L4 f" b; T, |; N7 H' R- w9 {
}
3 g/ U1 A3 @5 `4 xelse if (document.layers){
$ A% G; ?$ w' V& @, Z t' d; Dns_marquee=document.ns_marquee.document.ns_marquee2
( G8 j5 n8 d+ ]7 Ens_marquee.left=marqueewidth+8 ~: f2 u7 k$ m$ j
ns_marquee.document.write(marqueecontent)1 ?8 c; A, o2 W0 V8 t! @+ A
ns_marquee.document.close(): t- P |2 V+ X0 \+ j5 `( ]
actualwidth=ns_marquee.document.width x/ e) i& }) z( O; g- r
}" ]9 ~4 p5 E% C* t' V" d# i5 x/ M8 W
lefttime=setInterval("scrollmarquee()",20)
+ E6 x6 E% A" z}7 |1 i+ Y; q% u
window.onload=populate
# g! V, ~- m; V a6 x& q! I
. }- r0 j' d, c4 i; m3 m: hfunction scrollmarquee(){
: w, ]* p8 t1 e& w% vif (iedom){
1 {) v' V1 b" O0 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' y/ r6 _1 j5 t0 i1 {# dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; `5 _ Z+ k% j8 _7 Oelse* D0 D7 H3 s; T; b, e
cross_marquee.style.left=marqueewidth+8, m8 s/ E5 E/ S6 j
( y( h# Q9 W% y4 o$ @( @" @; {1 z
}
8 R/ L/ d% d9 g1 G& \0 H: Selse if (document.layers){
0 ]1 Q- c2 O9 T3 y* {3 M/ y, U! Nif (ns_marquee.left>(actualwidth*(-1)+8))
( ~* v# g/ S: X p% W( s Jns_marquee.left-=copyspeed
" ^ B3 \. z- q( b0 c7 i H Gelse
6 z9 V- L$ M/ |" w2 X8 E4 B. Wns_marquee.left=marqueewidth+84 |- h# c6 E9 q0 Z
}
# `5 v9 A" [5 b}) I1 @8 h- z$ `2 f! y1 `6 R
$ Y3 L9 Z7 _$ z6 w) m$ \& uif (iedom||document.layers){
2 I% D3 L# q( N9 Z7 `with (document){& _# K, K. d$ T/ {0 F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( o5 o: D" e- B1 B% Y$ ~; |if (iedom){( f" ^0 j" b$ X9 s0 M' e# A0 ]3 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* i# E! W7 M( z. g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' r% S$ i# x3 a7 s4 U8 g/ N7 a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') r( ]9 C- t) v$ n& n* T3 t j
write('</div>')
' {# ?; _6 T5 Y2 y8 Z- Z}: ^8 H- K9 M6 C! I s% O
else if (document.layers){
! X: k! C0 G4 k: c* q) H* Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); J2 v6 U' M7 q& r# R9 A5 c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# c% m% _) O& {: @& u
write('</ilayer>'): M, m) m+ i& F8 y5 q4 t
}; \8 B+ [' g$ A0 H
document.write('</td></table>')
: ~, e! g1 i6 _& r' |}+ K* A& s# `- @' J) P; G+ b
}& D% a6 V- h; r/ V
</script> |
|