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

|
网页之跑马灯文字特效
//修改宽度: R7 V/ c z& R* ]) D
var marqueewidth=300
9 s! \" P4 ]2 k6 h* I//高度
' a6 G% ^7 q8 l* a/ ~9 [1 b j# Evar marqueeheight=259 G& p6 c0 r2 w: c; H
//速度(1-10)
- @ H7 s% q9 bvar marqueespeed=3. v9 q% J- W5 K7 C- V9 Z
//背景颜色9 Q$ z$ }. Q4 h3 [) G- P
var marqueebgcolor="#FFFFFF"1 U9 z+ A2 N+ `" ]+ v, m
//是否能暂停 (0=no. 1=yes)?. }6 T0 F% Y" p8 l' B% m! x
var pauseit=1 i! j' N1 [. ]7 g
5 O" p3 }- W$ |+ N5 Z
//修改显示内容* Y6 F N1 k! s$ y3 q" Y. [; A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* [1 I6 g; @2 W+ w" m5 G% }
3 g6 T0 I1 `: [) O
. D5 V; u- m' G! i# C$ j////下面不需改变////////////
. }: P: c6 e( W/ I2 `8 i5 l; T1 f4 i) A, Q" E7 R" a+ h. l0 Z" p
var copyspeed=marqueespeed$ a4 A5 H$ S% N0 U: }7 ?2 P$ q
var pausespeed=(pauseit==0)? copyspeed: 0& j( O8 y9 ~: b( `( R+ P6 O* z* L
var iedom=document.all||document.getElementById
( ?5 V+ A$ Z: K6 rif (iedom), Q$ B) n& ~' W5 c s" l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: p; p$ n+ b1 r4 n# Kvar actualwidth=''
* H' r! F8 P( h2 r" Ivar cross_marquee, ns_marquee! b w6 [( s: L. T9 B, q* i
' j5 Q' a: n7 Z; D R/ P; b0 `
function populate(){
$ V p9 C8 k8 o* Y& Z. W* e+ f. o mif (iedom){
6 L+ b7 f% P3 D6 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& `0 u" h. D# E* B) K2 ~7 Zcross_marquee.style.left=marqueewidth+8
' Y$ K& i# O/ X9 s# z1 vcross_marquee.innerHTML=marqueecontent
( Z8 Y$ o# N. y& A, l/ ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, H2 d9 G) P) D* I, ?
}6 y5 e6 L H. ^. ]
else if (document.layers){
7 E$ Y5 F9 o, ~ns_marquee=document.ns_marquee.document.ns_marquee2# l s" L% h& \/ W
ns_marquee.left=marqueewidth+84 \+ ?' h$ `4 @. E
ns_marquee.document.write(marqueecontent)
) X, n/ e' ?4 x S1 @: ]ns_marquee.document.close()6 d o& T( z/ |7 ^/ U/ f
actualwidth=ns_marquee.document.width
5 N' Q6 j0 d* l% U}
- P: \) t( B: i2 `: y/ A8 Klefttime=setInterval("scrollmarquee()",20)
2 e- E- \+ S6 ^; M, T}8 s9 ~6 E4 t8 T4 ~4 f& q
window.onload=populate E6 R* _9 p+ ?% c. k
7 U/ `- G v( \8 B2 efunction scrollmarquee(){
1 g0 J T. m' p# R q, Oif (iedom){8 [: \5 I4 z) R @0 U8 S' ?0 I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 g9 X0 C& M- n' g5 n6 I9 D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 _' d1 W3 B: N* N6 C+ O* ~else8 h+ v) a+ N6 j' v0 M
cross_marquee.style.left=marqueewidth+8! E3 `# U& n4 \0 B: m% z
9 D3 W( l j2 g}1 g; n$ t, G1 ^/ x3 J* I9 A, ^ \
else if (document.layers){
9 M, y* `# A& o- ]7 S- }if (ns_marquee.left>(actualwidth*(-1)+8))( D' h3 ^8 g/ q6 Y' u1 I
ns_marquee.left-=copyspeed
2 T2 u# K9 }. I7 }8 Welse2 y7 w/ U2 _ {' {
ns_marquee.left=marqueewidth+8: D% ^0 ]! r, f# f3 U. I' U
}
% L' ?, u9 A8 v$ e. ?- w J}
- a' D% d; v+ T u" X' n% E+ i
; p. X' Y# b, { }+ q# X) C) xif (iedom||document.layers){3 c* @: ]5 K. z1 G/ y
with (document){/ ~ r$ ], Y9 ~. T' {4 O3 L+ m8 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 C6 S$ V; O( y, }, `% C( ~( {/ cif (iedom){# l% {. S( n3 X- n( s5 v" Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 j L. k; P Y% D6 ] v/ Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 N, e* ` W7 k. Z. x( u8 ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 J }0 X& @* q- }; K# l( `write('</div>')( T/ Q) a4 b( ^, c+ M$ | v
}. O, W3 G* z" e3 D
else if (document.layers){
# T5 W+ {+ w& e+ O* Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* g) V- h2 E* F; R0 ~( x2 |( n1 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" g. r4 H g# Y. p" z4 w& mwrite('</ilayer>')) z. G% r6 ^" a2 \. u
}0 e& h" c* }4 F; ^6 x
document.write('</td></table>')
- Y6 G2 [" U0 B# E$ H}( p. R/ P% b) y
}
- I1 f/ l7 Z! G* k. l</script> |
|