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

|
网页之跑马灯文字特效
//修改宽度/ O) J; ~6 w5 _( `/ }
var marqueewidth=300( r; j3 f8 o- ^" t! B: N5 j1 b
//高度
1 e! l3 Q/ h. l3 L3 j/ {: Tvar marqueeheight=25: A9 w5 t5 `9 G& F
//速度(1-10)
/ E2 u2 N8 ?* m: `& ~var marqueespeed=3
' W. C2 K! d8 n//背景颜色
3 m7 o% `- v1 p! U0 Rvar marqueebgcolor="#FFFFFF"0 W k. q" K F- m+ j/ [$ Y
//是否能暂停 (0=no. 1=yes)?
6 v+ y; s% a. |- |7 B6 N7 Qvar pauseit=1
5 r( O8 ^9 u, }/ }& v! }6 m. u t0 X+ L, e9 D1 g: K+ w" E1 a
//修改显示内容8 u$ t& ^( J g& l/ p5 R/ j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 y+ d7 G. ?; k/ j7 r% w
5 N" ^( }& V* B0 o
0 T5 J9 n( j$ B: [$ q
////下面不需改变////////////
4 E+ e' Y* M* k9 B* E7 T; i0 M8 \9 G; p8 h2 q+ ~5 o
var copyspeed=marqueespeed
/ K9 M# b. f1 J+ Q! u# ~5 q- evar pausespeed=(pauseit==0)? copyspeed: 0, W& T# d4 J5 F
var iedom=document.all||document.getElementById3 h1 `. D" g0 a, V. T2 u2 ^
if (iedom)) o! h/ S( y( v% d. |; ?7 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Y; C7 S) a. [8 e# t$ g5 Z4 h1 _var actualwidth=''- s/ b& G* E2 ]
var cross_marquee, ns_marquee5 g' I4 Q4 x; }1 F, ?8 B3 g
6 B& S \! F: b# q, B7 pfunction populate(){
5 p7 Q$ I* X- X( z. @# S; R9 g. Fif (iedom){
+ _9 X" x9 `% O+ k" dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; B- W( y" G5 b* }' [6 L( Ycross_marquee.style.left=marqueewidth+8
7 O9 F% C6 t- I2 `+ u- y$ d; across_marquee.innerHTML=marqueecontent
2 o7 M, I8 L2 T+ x p* W2 w& ^* uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: B/ s2 r2 S( d( j}
! q a! b U# _/ M# B8 pelse if (document.layers){
- k+ `2 `" N6 i: B. q. ]& Ins_marquee=document.ns_marquee.document.ns_marquee24 `0 s. X1 A1 D. \
ns_marquee.left=marqueewidth+8
! }) h5 j5 N9 r# k: p. a G% Lns_marquee.document.write(marqueecontent)
8 o6 T2 y& `6 y$ Ons_marquee.document.close()
- u7 y/ D7 ^( J5 v' cactualwidth=ns_marquee.document.width
" Y# y8 e3 R" d) _* ?}
: m9 m( q) q' z J8 T9 llefttime=setInterval("scrollmarquee()",20)
; v: ~5 ]. ~& d( c6 b4 j}# _! v! |4 s9 Z# C. c7 z+ s3 o
window.onload=populate
# |3 ~6 L9 F; n. k. T' v# M: `) j, q7 ^
function scrollmarquee(){
! X: h6 ]! U2 Nif (iedom){
* X) q" x, U& E7 a' `' X M+ X3 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, X0 L$ k; l/ A$ ]; M" Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ W4 b; Q5 ?( _3 v% Felse
% R a" V$ h4 I# G9 k+ ~$ S( jcross_marquee.style.left=marqueewidth+8
' q( d% B y9 Q, z, Z1 }: m
5 ^3 j R" K/ v4 c}* f+ Z) w2 q( B1 n# |) g; Z0 q+ W
else if (document.layers){: b# O% }2 o* V4 h/ o
if (ns_marquee.left>(actualwidth*(-1)+8))$ L; K' E: }$ z$ b2 g7 o
ns_marquee.left-=copyspeed7 B3 P5 {& A6 |1 ~, K
else
% y2 f" ~3 t. Zns_marquee.left=marqueewidth+80 P/ P; L) h6 \' N8 T
}
9 {# l+ r/ [% ?( \ r; t7 y: T}
0 @1 P- A3 `# }: _$ e6 h T
# T3 f3 X: v5 s) u2 Qif (iedom||document.layers){
; l# S9 o3 v7 K) O/ Fwith (document){
" C$ x7 s5 K4 o1 N1 n5 L0 z, v, Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' `3 C. q0 `: Y" V3 S. x) pif (iedom){: ]9 i$ T" l' g$ F. r) p# } w" F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* @! y, C" F/ hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ {! w! y* A: ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
U: U6 Q; w. D% G9 ~write('</div>'), W/ ?) b, M u; T" _
}
0 r) ]; v1 S; t/ x9 u @5 i5 G* Eelse if (document.layers){
: N& N( z v f: p: W6 G! |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 \: C. R/ x, t8 S$ Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 k! G5 E" I" {( q& h9 iwrite('</ilayer>')
+ c% U/ S) k4 @0 A8 A}
/ p7 z! S/ W" vdocument.write('</td></table>')! D Y% S0 }$ j. G+ L3 ^+ |/ z
}8 k2 ?" C X U7 [
}
, Z5 ^9 }- }7 ~8 S3 j</script> |
|