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

|
网页之跑马灯文字特效
//修改宽度
o: I: V0 s! \ \& x4 Qvar marqueewidth=300# i* O/ z% f" E7 j5 P0 a
//高度
6 n2 z- P& `: P, S" C' E+ ?var marqueeheight=258 W9 |8 X ~ n4 E3 H t
//速度(1-10)
3 c* k9 x: E, b7 R1 {0 t! v( Hvar marqueespeed=3* ]$ v1 `) D8 ^4 u2 u ~# k; ~
//背景颜色
* N* z p; H9 d, H" b: `var marqueebgcolor="#FFFFFF"
, Z8 z6 f) q1 A' ` j" B- U//是否能暂停 (0=no. 1=yes)?
: u, O5 ^ u- |var pauseit=10 m5 N$ m2 C/ w! f! C5 i
; ]' T; l" Z) X. j8 f
//修改显示内容4 t" G- {$ N2 m. S" V. r$ q+ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 g; ]" C$ U2 d; t1 \- o$ z4 o. Q; p+ D* ?, Z6 k4 j
: `7 w: N' `6 n6 r) k. h
////下面不需改变////////////
! ] f4 H4 R: N+ H" E. i0 v# Z& v8 b, S2 `. i! R s$ A5 H# @
var copyspeed=marqueespeed
. f5 e- G7 G: s- p* e" S' p+ bvar pausespeed=(pauseit==0)? copyspeed: 0
6 X5 i0 u2 t/ D: s: u$ Wvar iedom=document.all||document.getElementById
+ U: n$ B2 s2 T5 B }9 D+ {if (iedom). o& t4 Y$ R! Z( `( W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& G; O, w( c3 `5 z" zvar actualwidth=''0 r; D, g6 r% z$ r% ?; R/ F
var cross_marquee, ns_marquee, c- m1 f+ M+ R
8 _' L& ~7 {+ }
function populate(){
' z3 `5 i" F6 A4 sif (iedom){
; p+ [ z" M, Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, Z7 b% G9 z. L: E
cross_marquee.style.left=marqueewidth+8! _9 V- M) h4 `& s7 Q
cross_marquee.innerHTML=marqueecontent
' N! I( ~/ H3 f; bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! u% C# a' W: n}* h6 w8 r+ _& m
else if (document.layers){3 z9 M9 L2 ~4 V0 A$ s
ns_marquee=document.ns_marquee.document.ns_marquee2
2 g, n2 P- Z _3 M7 Bns_marquee.left=marqueewidth+8, S4 x; z; g1 j2 S" q# b
ns_marquee.document.write(marqueecontent)
4 Z, Z3 g7 `$ k; ons_marquee.document.close()* v/ [! O3 w6 ^' j
actualwidth=ns_marquee.document.width% s0 ~5 A) [5 E, L, n# _
}5 o, F2 o2 @( z
lefttime=setInterval("scrollmarquee()",20)7 ~ |( U# S9 j2 B/ g X
}
7 o; G$ d- `; Fwindow.onload=populate
" E6 R2 q# r: K1 H% w& k, ]( s4 i( {+ ~, s0 {* |2 X4 B
function scrollmarquee(){
1 U- }/ ^- }# a0 \: P7 K; Fif (iedom){4 G7 O, d. ]+ q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 J3 @1 C, @4 r3 S/ C' ~. B3 I" }8 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) ]0 u' p/ |6 B) G% k
else; `2 m! f1 |/ |$ o3 r; [
cross_marquee.style.left=marqueewidth+8- l5 c0 x n+ j% D# k: M1 g) H$ R8 Y4 `
( F' y* w+ [9 K' m}# W( I! D5 ~8 L+ ~! ]0 `% O D- t
else if (document.layers){- z, s5 J# h' X+ B. X/ P$ `' D
if (ns_marquee.left>(actualwidth*(-1)+8))
& x+ Q# h3 `( b+ }) s1 g" y6 qns_marquee.left-=copyspeed
. Z/ c" [- J% s3 R8 m3 X. l9 U' nelse
# a+ x- L9 ^8 ?( N& Ins_marquee.left=marqueewidth+8
: u8 w, R* [% T) w1 }% Q}, q1 C5 h; C2 ]8 W! X
}
' U1 b) X0 A) G* \+ L& j
/ H/ o. z; W1 h) _if (iedom||document.layers){
7 o- |( ^7 i% w) \with (document){1 @+ _/ M2 j6 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); m% s: f- |( W2 x! `* c
if (iedom){
# |( C; e. b1 E) k! O0 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). t, y0 v- ?) X- w# S. G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" }! c' W/ }' Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Z. F" q7 S; _. Ewrite('</div>'). L6 y1 F+ j( D2 w! ^
}* Q4 K' _: j: i& H5 c; n6 i; a
else if (document.layers){
/ ?+ L1 g+ k8 [) Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' N, i" r" b5 g. b! H& t9 [, |) _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% \. p; C# J' G$ V2 Q" V
write('</ilayer>')
# S, Q7 N& c( k$ t1 l( c! f}$ H% g. s( |% m
document.write('</td></table>')
* `; s- y6 t+ x7 K, ]* L}4 q+ ]! ]0 {; b- g* Y
}
; }' z- m9 ~' r* L3 x6 i+ {, k</script> |
|