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

|
网页之跑马灯文字特效
//修改宽度7 I. b3 O5 [7 ]& s& z
var marqueewidth=300
8 \) a3 Q! t. }9 f( H//高度# Y0 V% W/ H) d' B: `
var marqueeheight=25
; x1 _# X4 O- J% W. O; C3 Y//速度(1-10)1 X' w0 x! Q- h+ X$ n$ v
var marqueespeed=3/ }. l3 m7 g2 K; [4 N
//背景颜色
! B5 d! ^( M, K6 x$ Y; |" X/ E% e- Lvar marqueebgcolor="#FFFFFF"
0 t$ o. V3 `9 A$ V% \/ U% v//是否能暂停 (0=no. 1=yes)?" @/ U. f8 N* Z" Z, d
var pauseit=1# X# Y* C% j8 O% P
3 U" x4 ~& M4 [% l5 B' @0 i9 y. I//修改显示内容. X( S m( U* z: s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& c1 D+ X0 F) \. ]2 W% w0 K
- N. ~2 J9 h% d9 `8 H# j4 a8 C8 h G: I
////下面不需改变////////////! V& y" [ ~! f( q+ u, m* a8 W) |! Y
8 \9 O' {0 c1 o7 z/ a. Q* Nvar copyspeed=marqueespeed5 T+ ?" O! B: v, v: j$ l' S1 M
var pausespeed=(pauseit==0)? copyspeed: 0# |# {9 r; m: Q! |2 I
var iedom=document.all||document.getElementById2 A, U( J* \" j& _' d
if (iedom)
: D0 X7 P- j) b% mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ N1 S" [1 r6 ^. K: \: Svar actualwidth=''
: t! r h( R8 T! J% V- `var cross_marquee, ns_marquee
4 Z' g1 u4 h1 D8 H( `
2 }/ ^# M# i- |) ]* a0 |1 Xfunction populate(){
% [0 X; S& p+ T/ {( [7 Zif (iedom){
: x7 d& {' S1 p) n1 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
Q6 e/ n2 O( V7 I+ i( l( L( ~- Qcross_marquee.style.left=marqueewidth+81 S% G3 d0 {% g5 K$ m4 p
cross_marquee.innerHTML=marqueecontent
( R* h) T" g; @! O' uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% M- Z9 H: N% e/ _. @. T8 }3 Y* S$ n}$ P8 ]( J4 U9 ?+ C2 H& U' Y: u- w
else if (document.layers){
; L" P. ?5 E% l& tns_marquee=document.ns_marquee.document.ns_marquee20 z; `! o" @) u8 U
ns_marquee.left=marqueewidth+8
2 A7 I v4 s; sns_marquee.document.write(marqueecontent)
$ m) Q# ^7 r+ x- h1 _7 fns_marquee.document.close()
1 J8 t# e9 b0 d0 g, q0 pactualwidth=ns_marquee.document.width6 \3 o; `* I7 X
}, t$ }9 W: K% o, [2 K- @# u6 ?6 w
lefttime=setInterval("scrollmarquee()",20)
- P( d9 J D) g* X7 Z- O6 Q}
8 s0 M( K) c# S& ]5 Zwindow.onload=populate
- f- m& i# {( z, k% {6 m1 e k" F" X! h4 j) ~6 n S
function scrollmarquee(){4 g; ~7 n% [; a2 W Q% ^
if (iedom){
: Z3 i7 L7 h) D7 m9 b: Y3 Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), S7 v/ c1 G8 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
m6 P% \* Z+ G0 ]7 ]5 D, O6 Relse# P& @% z% s3 }4 B% w/ S
cross_marquee.style.left=marqueewidth+8
' `- ? n E* m' d4 e" t% Z5 g7 |% M# Y: i4 Y
}
+ ~7 Q2 p7 N# n" R3 Z( Jelse if (document.layers){; `( o* T& p7 }+ [/ I2 G
if (ns_marquee.left>(actualwidth*(-1)+8))
# i7 k9 I' [8 Y7 r4 v! Xns_marquee.left-=copyspeed
, I5 g& W% i& X) W) U% V2 Xelse
+ K! o9 h0 I8 r5 S1 u) uns_marquee.left=marqueewidth+8
) B; G7 x1 ~1 A L}2 d3 {7 U9 p$ u& I; y+ D& b, g
}
5 I) D' c* D+ R0 X& y3 X" O9 s/ h8 [" _6 B; [) q5 } Q9 E
if (iedom||document.layers){
9 n9 b" Z+ R! Q. [8 U" A6 Bwith (document){9 R8 U. P d- v! Z! e, P; E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- S4 y) _/ L7 q4 T* B1 Zif (iedom){
8 L! z* u# T1 I0 R- _6 w& r! pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
D8 T& e4 [1 n5 t/ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ L, p* J# L8 L$ Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 r5 k0 B, M# Z) G! a
write('</div>')
# U' b& V' p$ d9 \9 s7 v2 k6 ^}
1 n& P7 d% @: q% C* |else if (document.layers){
5 t, e3 C5 ] N# n, g2 E- ?( Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& z/ r" \8 y' B' R: \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 c2 L7 ^4 Q! ]) I: e
write('</ilayer>')
, n# q2 t, j& o" w}- p8 {0 L' `; d' S6 a' E
document.write('</td></table>')) I# o. t. b, b, @: |( q
}% X4 Z _7 W5 Y3 c8 b( F) m& A
}
* C8 o, R) y {) x4 S3 w</script> |
|