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

|
网页之跑马灯文字特效
//修改宽度( S; T1 Y& x* W* q! Y
var marqueewidth=300
2 W5 K) k0 A* g9 U2 c! }* \//高度2 J: }# X* ~ y% A" v/ @- k' Z
var marqueeheight=25
9 \9 L6 u$ ] B/ L* A5 Y8 G$ _' \//速度(1-10)+ l$ L" d: e1 x/ G# }* J( e
var marqueespeed=3
6 B: O0 ^# n/ H d' ?//背景颜色
. g" [0 L+ _ L+ {. A8 @var marqueebgcolor="#FFFFFF"
`3 t3 n0 l. ?+ \& u' m/ J//是否能暂停 (0=no. 1=yes)?
9 M5 u3 u/ u! K7 p+ |! ]var pauseit=16 h& r% x7 p4 I0 H
( b0 s' Y& `3 K$ j' R0 |2 i* ~
//修改显示内容
: O @1 i% C( f2 ^/ k8 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. L2 C0 X/ c0 r. D* F- N8 Y: T
* V! U& N& W$ j) \% S7 R! A
- Y: q0 e; W2 I6 @: o* P////下面不需改变////////////; W" J3 L. `, r
" A$ j: ? `! j
var copyspeed=marqueespeed* m! ^! \3 G( ] n# N' P1 l' \
var pausespeed=(pauseit==0)? copyspeed: 0+ W" h- W; B( F9 w
var iedom=document.all||document.getElementById) I5 o6 w- q) c- C( i
if (iedom)
6 w( Y; H4 O' A* udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 j$ d9 L$ g( ~4 f3 E2 Z1 D1 G+ Tvar actualwidth=''
$ b0 a' {4 m/ {+ j1 ~7 [var cross_marquee, ns_marquee, D! B% B7 o+ Q$ l B
, X8 R* h" `; J9 l0 R
function populate(){
. P3 B) I f Iif (iedom){
4 z3 b' g# b9 q0 u! l7 A& p/ G: \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 t {* p& k9 p8 n
cross_marquee.style.left=marqueewidth+8
5 ?/ z! }4 p1 i) \; mcross_marquee.innerHTML=marqueecontent
; ?9 a& Y- `) {$ z) pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& _. P0 c! w3 X s! r
}% i& _9 C7 v5 u+ m1 J
else if (document.layers){
! m k' {' P9 G6 t2 f; G/ s9 B4 Ens_marquee=document.ns_marquee.document.ns_marquee28 w% O- x' c$ I1 u8 C5 P1 V1 z2 m
ns_marquee.left=marqueewidth+8
1 o6 e! g7 a2 _ns_marquee.document.write(marqueecontent)
- C! D( q% E% i" ens_marquee.document.close()8 R0 [9 ?0 L' y1 H
actualwidth=ns_marquee.document.width' J/ A) t- P+ m/ f" v/ o
}2 i& J9 Z+ a9 S. d; `
lefttime=setInterval("scrollmarquee()",20)
! z* `# a; i3 G}
7 [, |: v% S* w' S2 }window.onload=populate
7 Y! D8 D9 W( Z O _& s! m+ z( N
- c; k5 ~4 M% d& mfunction scrollmarquee(){ R3 A. e4 D" m3 W5 k3 Y
if (iedom){$ ?, k, H: E: Z, B$ O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 @4 Z' x, x; b1 k! J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 g& m6 x" h& B* xelse/ Q* y0 P# O" X# [# x; P/ q
cross_marquee.style.left=marqueewidth+89 m( Z/ c# i b: B! H; _
% \" [7 c: O' f7 R) K( `* |- @
}9 ]% ~7 I5 X, [; ~1 C5 X* u
else if (document.layers){1 n7 `; k3 f. ~# b% s
if (ns_marquee.left>(actualwidth*(-1)+8))
6 A5 x9 { B7 s/ D3 h, qns_marquee.left-=copyspeed
4 R: `; N/ M4 Jelse
6 P o1 h9 F, x, L/ l8 L% b8 nns_marquee.left=marqueewidth+88 ?6 x. v. u# f6 R, ]' g; N
}5 q+ U# O# j) H! g
}
8 L- F, f! u. [( l5 x" G! ^5 [
" T) D7 x* K- S3 L0 ^if (iedom||document.layers){
5 {! E" r b2 \/ twith (document){
* ~, k; K |, Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ k; K1 v: k4 p$ z: p
if (iedom){5 a8 I) _) r T9 W1 _# z+ H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 k+ D! G4 p& C/ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 q0 Y! J1 |1 |1 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 x+ b8 r2 A0 h1 M
write('</div>')
6 G! o6 j. f+ l, a1 n}5 u. U3 u+ Y, o2 M0 d C
else if (document.layers){
+ |$ j- h4 ]! d9 a& E) W6 U5 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( G6 E% a3 M' {) i% Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" G4 T4 [, E6 U0 Z
write('</ilayer>')
& G) l# i o L. H! O}
5 A0 O' L! A2 D2 rdocument.write('</td></table>')
5 T2 l' I9 b& m1 b; b; c$ K" X}
, k) k. \: B( E, ~0 i9 e}+ o8 y) s' J; b0 E
</script> |
|