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

|
网页之跑马灯文字特效
//修改宽度
' v) g K# ~4 j3 E5 Cvar marqueewidth=300
& ]! ]# `; R3 w$ |- _+ i, A+ T//高度# _3 D; Y( \* D, d) w
var marqueeheight=25
5 L" E2 j! Q6 d8 N. {//速度(1-10)% O' v& S( l. A, J8 v
var marqueespeed=3
2 C9 B% V* L3 Q! L# j* v& P& y//背景颜色
# C2 p) i$ ?% h+ x2 bvar marqueebgcolor="#FFFFFF"
, a2 X8 c! {: |. A//是否能暂停 (0=no. 1=yes)?
* a% k5 ]1 M, Z% Bvar pauseit=1/ e# w1 F2 f; e9 e, p
( Y8 e8 S/ O' X; v& U//修改显示内容+ |' B0 U0 I, I/ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; M* ], c/ X. ~: b! O! W
* v I h$ H9 T: S. B/ ~+ J' B5 T- Z: T) K0 i7 W' U
////下面不需改变////////////* U( m3 O3 {& B* `+ B$ `
1 z" e3 [1 [. B0 [' lvar copyspeed=marqueespeed
) t) |6 x+ U$ Q2 z3 Dvar pausespeed=(pauseit==0)? copyspeed: 00 x/ b- C; V' q% k& Q5 A5 O0 P
var iedom=document.all||document.getElementById/ m* X" S: R5 P4 v
if (iedom)
* b ?3 C/ c/ A8 b! p9 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). V1 `, {5 |, A# u4 f# `6 O1 X
var actualwidth=''
7 ?% @0 F- F* |4 Wvar cross_marquee, ns_marquee
( M5 L6 K$ t- Y7 x0 h9 z) _- v! O
6 J2 ]9 v. [0 B% _4 vfunction populate(){
. c |( B) e$ f$ K- I2 t& @% Gif (iedom){
- x8 H {# n: D3 V4 L# Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* X% f7 s9 v3 S! l( V1 Scross_marquee.style.left=marqueewidth+8
# u# j9 L7 r4 ?; qcross_marquee.innerHTML=marqueecontent9 X, B5 y9 H: U; O+ a& g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 i! |3 O* U; u/ m& i" k! y}+ l/ b k% i2 E7 Q, l
else if (document.layers){
" z$ W/ v- G8 a9 H9 M3 i" Ins_marquee=document.ns_marquee.document.ns_marquee2# w4 ^1 e" x0 H
ns_marquee.left=marqueewidth+80 _- v% F% u3 r' H
ns_marquee.document.write(marqueecontent); a/ T6 g) j7 S: k- m/ z: {* W
ns_marquee.document.close()& X+ E" t6 A7 T2 o$ b% n3 l
actualwidth=ns_marquee.document.width/ I; G- S2 Z0 D
}/ T$ z$ `' G: a$ A
lefttime=setInterval("scrollmarquee()",20)# f1 G, a) w/ o# O5 {
} o; E" o, _. D, j
window.onload=populate
2 Z q1 z8 ?' ]$ j3 E6 T
9 m7 u; A$ S& A6 v9 _function scrollmarquee(){0 F# l9 T, i7 N; C
if (iedom){
|3 S8 e6 k9 Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' S" a }7 j+ [1 ^0 r2 V% n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 g' N. c1 ^$ e" i) C
else
- y3 \5 J4 e! g1 H: ecross_marquee.style.left=marqueewidth+8- L8 Z* \5 g, b. H! H
7 m& N3 n9 O e; ^
}
" f: L( V* ?7 J/ R& p" Gelse if (document.layers){, }6 d: ~" h+ M' v% k
if (ns_marquee.left>(actualwidth*(-1)+8))
: X/ q4 Y1 H' M2 E, mns_marquee.left-=copyspeed
. M/ B/ V g. u$ F: l; [else/ P0 Q* q/ v8 Y6 ?& J. l
ns_marquee.left=marqueewidth+8
/ Q; x; w0 S& j/ Y}1 M3 Z* u( W3 k) D/ h, W
} B/ V9 b5 F7 F$ n2 U: P
) s5 }( |* F7 I1 m& {if (iedom||document.layers){! z, M1 T! q5 Z" e/ k; C4 k
with (document){
6 x1 d! m. ~9 u) _1 \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 j: r1 O+ V" h6 Z; }if (iedom){
$ q+ \7 Q" _8 n7 f- dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). }& \7 \/ s1 _4 x) J% `# I9 E: H, W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. i: \- F6 E `5 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' t) H( C" Z: ~) m% E+ C
write('</div>')
9 B1 ]& S$ U2 K9 y}
Y0 H# A5 F$ i0 G2 O3 I& i6 pelse if (document.layers){
& D/ Z% N' `8 U. m( @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& ^3 j0 [$ {& x( _5 E' x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 ?* n2 }7 ?- {- ]5 x1 Bwrite('</ilayer>')
d! Z# Q/ z( S7 q$ o7 b}6 y5 ?4 @/ _; _
document.write('</td></table>'); L0 `8 x6 H" t- G) \
}3 d0 q# ^- i+ J, B; [
}
$ \$ ]! I3 o8 i! z+ X7 I& m @</script> |
|