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

|
网页之跑马灯文字特效
//修改宽度
6 l. g- d' v4 Z5 p; p/ u& Jvar marqueewidth=300- C" a3 E8 Q3 ^5 J8 }' \
//高度
9 G% C6 q- O: Nvar marqueeheight=252 W; Q2 d% k. I. T" m/ {* c, T
//速度(1-10): w2 L1 H1 Y' b8 _
var marqueespeed=3% Y% z: X. _+ @6 P4 A4 ^9 W
//背景颜色4 R2 N2 u8 t R L, n- T, N
var marqueebgcolor="#FFFFFF"2 e& z W# H/ }$ S k. l
//是否能暂停 (0=no. 1=yes)?, w% C7 N# C! {8 i
var pauseit=1
/ ?6 G+ \! n9 W6 ~+ w `% ^: Y$ s; E
//修改显示内容
: B, n9 C% D) t: v0 t* J* [" K% uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% G8 w0 v' T" o) ]6 e) }# w0 @, T* x" c' C t2 [
, p6 y, S$ Y% S k. {
////下面不需改变////////////
0 K Z4 Q: R1 @# o
8 j' I6 g& G7 b( avar copyspeed=marqueespeed
: u* e5 a* ^. t, z5 Lvar pausespeed=(pauseit==0)? copyspeed: 0
* j! y3 U. v% j# m* e- Dvar iedom=document.all||document.getElementById
$ {/ U: O0 f9 [* K Aif (iedom)
+ z' y) |0 Y# l: ^/ V qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 T3 w D+ L* O9 h! a6 M
var actualwidth=''
3 N" J5 B- p& g8 O Cvar cross_marquee, ns_marquee9 O4 S( i _ s, S. J4 ?7 _% i8 O! T
$ W/ s- c" h- o& [, ^7 ]function populate(){0 P3 p" V2 G. v, ]* ~3 p' ^1 c
if (iedom){7 @" ~) ~/ D; r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) t8 z8 `( }+ d& j8 r$ O$ i7 bcross_marquee.style.left=marqueewidth+8" @( p& X! [+ G [& o5 @
cross_marquee.innerHTML=marqueecontent
! v6 f6 u( M( Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% [) }0 F" H2 ]7 z
}/ c- G8 C9 s# B4 U" i
else if (document.layers){
; e) R# x4 m& G E# _ns_marquee=document.ns_marquee.document.ns_marquee22 }( o8 Y# ~9 G' S/ K1 h" Z
ns_marquee.left=marqueewidth+8
% y% ^1 {0 u/ d# _. fns_marquee.document.write(marqueecontent)2 S- B9 x l! A: P5 g* c
ns_marquee.document.close()- w3 _ w; W2 C2 A, _" X8 n: ?
actualwidth=ns_marquee.document.width
/ ]$ o" v- f6 x/ o}
, D0 \6 e$ x# g e0 Rlefttime=setInterval("scrollmarquee()",20); _. F* C j! T2 k! F4 k8 y
}* X: ^- K O- d7 y
window.onload=populate
$ h% P" o3 E! _& `! I; w
* i+ l8 j k4 |6 ]8 A4 u0 F# Bfunction scrollmarquee(){
6 `. i! F; Y4 k. U8 F. Kif (iedom){
6 }4 w1 Z+ J+ Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 Z& L6 t: D" r! R3 C# ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( e( k) `0 o* m3 V. Z H3 v8 o
else' a1 `% l% ]/ s/ ~8 C3 l
cross_marquee.style.left=marqueewidth+8
2 e: a1 }+ h* }. U+ E, P# n4 g) R5 B& m6 A; j9 L6 M+ Q( J! }
}* x$ a4 e$ ^, [5 @$ _4 f
else if (document.layers){
7 d3 h: S9 Z$ c. y) Xif (ns_marquee.left>(actualwidth*(-1)+8))
5 K) K8 |1 l+ H7 ?+ [$ X: V+ bns_marquee.left-=copyspeed
+ M: S" j$ t5 K- D3 b3 Uelse
' J4 {0 S* j/ w% kns_marquee.left=marqueewidth+8
- O7 F h2 Z" `: n/ g- A}, U% p$ ~; y4 @/ E! D2 q
}
2 u7 I0 K& I3 b& F- m
$ G: t# Z- N# k5 x6 N2 Nif (iedom||document.layers){
# [( |+ X# z* B( }5 C. j$ o: B0 rwith (document){
+ Y7 J" d& |9 ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
h; ^) w1 M! `( o' W1 _1 Dif (iedom){3 E) e% w3 n# \' \9 I% G5 P e+ \3 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* l1 N% ?, G0 V7 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ a2 t; |7 a C3 V$ n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, e1 X o+ Y* zwrite('</div>')
$ O2 D: A8 W' v$ Z' y}( i. V0 [% W3 U2 y, {
else if (document.layers){
: r5 a2 v9 i" G: y# Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# l, N" n* R; f, \0 S( ]3 D& s9 ?4 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ y* [! d$ f1 a7 W! D5 ~
write('</ilayer>')+ k* ^% G- c" h$ ^; s m3 x
}! M L$ P+ @7 X( Y
document.write('</td></table>')% J3 a7 G0 A% [' h4 K
}
2 C/ A+ M- E. C6 U}
) k: }0 B, T7 ?</script> |
|