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

|
网页之跑马灯文字特效
//修改宽度 z8 Z9 ^* ^7 i* w5 X2 n H9 X
var marqueewidth=3002 z; T4 g& s7 b+ h, u! v
//高度/ q4 P; _; R. Z( p1 X7 o4 t
var marqueeheight=25( f, t& D" _, V# Z
//速度(1-10)
) {6 @5 C& ?; J6 o: hvar marqueespeed=3
1 S- v1 Y% }3 X6 L! e0 [//背景颜色' c! u; V9 o1 l6 q: G g& E
var marqueebgcolor="#FFFFFF"
7 v8 i0 ~, U+ U7 c! z//是否能暂停 (0=no. 1=yes)?; p- n2 N/ Z! @2 c
var pauseit=1
# p1 A3 ]. p0 D9 O/ h% J
4 Q2 O' Z- G' t5 l//修改显示内容2 A* |0 I; v1 Z" U- Y4 P1 f+ G1 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" ], T; F4 p% G& H( F/ H: z+ J! g4 ?
4 o# X1 t& i+ p* l8 `/ U/ i////下面不需改变////////////- J6 W; l, a6 v( [
0 X! Y* t2 l, L# x9 h" d
var copyspeed=marqueespeed& I' D- q" T7 f3 Y, e
var pausespeed=(pauseit==0)? copyspeed: 0' x c/ L1 d" n
var iedom=document.all||document.getElementById2 I: y" F7 ~" R% B1 i- s
if (iedom): H: P3 q7 {6 F! j3 @
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 _) n1 o2 U, [6 X# _var actualwidth=''$ A9 |% k, F+ x l* t
var cross_marquee, ns_marquee
) t3 T; _$ g* e# c: R
/ x% `% O: c5 d* D$ B2 }3 nfunction populate(){
& X" |8 A3 S# Z( \# ~0 L7 Gif (iedom){" u, ]) n- ~' _" a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 G; T: n% h; p: e8 C+ ?1 O
cross_marquee.style.left=marqueewidth+8
1 C8 W2 K4 `) ^3 S: I" ]' Gcross_marquee.innerHTML=marqueecontent' l4 t2 f% {3 s$ k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& T7 k E/ S; n# C3 p, d
}. l5 B2 x1 f# `% J- m: i" E/ F
else if (document.layers){
+ {5 ~3 ?/ N$ D/ ^3 A8 U7 b* ]- Tns_marquee=document.ns_marquee.document.ns_marquee2
; x" K1 Z1 K+ a# j8 `ns_marquee.left=marqueewidth+8
l1 [8 I+ z' Z' ]+ E) ?- p6 Yns_marquee.document.write(marqueecontent)
" ^4 `; s6 d: r! I. X9 b5 q2 i+ ~ns_marquee.document.close()
# y. v0 K1 I% K: O; N$ lactualwidth=ns_marquee.document.width
/ C. t- D- ^3 {; c: P} F! C5 K& ^$ l; a, |+ O2 b4 A4 L
lefttime=setInterval("scrollmarquee()",20) I3 E+ M. n! a/ H* M
}4 e+ c" t" u1 F
window.onload=populate
0 e: e O( {8 O& k% ^# l0 E3 q" R4 l6 Z
function scrollmarquee(){9 N6 @3 `% H/ O6 g) e& b
if (iedom){
# `: @, ?) A- k ~$ nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): Y; p" {5 }$ F2 w5 i+ ]/ p# Q8 t" i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ S# d0 \) v! S" ?4 J6 J# delse& f* n8 x! ], P1 O$ L: U
cross_marquee.style.left=marqueewidth+8
* U& K6 i) A5 H [
3 M+ D {+ }$ n# H}* G- R& ^. j; a) Y9 y- {0 P
else if (document.layers){
2 ^1 h# |( m: h" `1 a1 Z& V# Gif (ns_marquee.left>(actualwidth*(-1)+8))
0 I- }7 c5 M4 U$ b2 b$ Lns_marquee.left-=copyspeed
4 j+ r. X9 i9 T8 z2 Relse# L% ~: S- ?% S; A6 r' {" [
ns_marquee.left=marqueewidth+8
. }5 F! Z/ s2 c8 \# k/ y; G/ Y, F}. e; {" _1 U; J* N' R1 G
}
# W0 a% K* F8 f: \4 Q9 h X) J& ~$ P# j; }9 u
if (iedom||document.layers){
0 D0 B5 }. e/ W5 Z! U' Bwith (document){
5 [+ e# z. N5 @8 p! Y C, I2 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! n* _! k& |1 b" L& ~if (iedom){0 g* ], w4 f3 I, h7 A: v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- C& k" `5 s0 [3 F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. s/ w. }% |7 C- ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ Q& S( q C- d1 F7 e6 nwrite('</div>')/ b! P+ l/ L; e; d1 }2 m9 F; @" Q
}
2 f1 w7 W; F/ S" E6 ]else if (document.layers){
# Q; p6 G8 G$ D: x, A/ pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 n) M9 P8 S9 c6 f& G! T# Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); u' c& H* V# F! J( z+ c
write('</ilayer>')- I3 U+ v! g* H# y' d+ X
}
6 o, G$ y5 C ^; |document.write('</td></table>')
! ?' p$ x. a- t8 ^, r} h" y" V5 O+ F2 U" L
}( v0 Z6 x8 a9 u/ a7 a' P
</script> |
|